Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@
"nx": "19.7.3",
"typescript": "catalog:"
},
"packageManager": "pnpm@9.5.0"
"packageManager": "pnpm@9.5.0",
"pnpm": {
"patchedDependencies": {
"@rspress/plugin-llms@2.0.0-beta.3": "patches/@rspress__plugin-llms@2.0.0-beta.3.patch"
}
}
}
39 changes: 39 additions & 0 deletions patches/@rspress__plugin-llms@2.0.0-beta.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/dist/index.js b/dist/index.js
index aef8541261e1efef20f5e3ab4042efebfd20a2d7..72d3b24f6d1c1174db13bab555d10ca9018b0f28 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -377,19 +377,26 @@ function pluginLlms(options = {}) {
if (isProd) routes.push(..._routes);
},
beforeBuild (config) {
- const configSidebar = config?.themeConfig?.locales?.map((i)=>i.sidebar).reduce((prev, curr)=>{
- Object.assign(prev, curr);
- return prev;
+ const locales = config.themeConfig?.locales;
+ const isMultiLang = locales && locales.length > 0;
+ const sidebars = isMultiLang
+ ? locales.map((i) => i.sidebar)
+ : [config.themeConfig?.sidebar];
+
+ const configSidebar = sidebars.reduce((prev, curr) => {
+ Object.assign(prev, curr);
+ return prev;
}, {});
Object.assign(sidebar, configSidebar);
- const configNav = config.themeConfig?.locales?.filter((i)=>Boolean(i.nav))?.map((i)=>({
- nav: i.nav,
- lang: i.lang
- }));
+ const configNav = isMultiLang
+ ? locales
+ .filter((i) => Boolean(i.nav))
+ .map((i) => ({ nav: i.nav, lang: i.lang }))
+ : [{ nav: config.themeConfig?.nav, lang: config.lang ?? '' }];
nav.push(...configNav);
titleRef.current = config.title;
descriptionRef.current = config.description;
- langRef.current = config.lang;
+ langRef.current = config.lang ?? '';
baseRef.current = config.base ?? '/';
docDirectoryRef.current = config.root ?? 'docs';
},
1,896 changes: 994 additions & 902 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
"diff:v3-v4:mjs": "git diff @callstack/repack@3.0.0:templates/webpack.config.mjs HEAD:templates/webpack.config.mjs > src/public/diffs/repack_v3-v4_mjs.diff"
},
"dependencies": {
"@callstack/rspress-theme": "^0.0.2",
"@callstack/rspress-theme": "^0.0.3",
"@rspress/plugin-llms": "2.0.0-beta.3",
"rsbuild-plugin-open-graph": "^1.0.2",
"rspress": "1.42.0",
"rspress": "2.0.0-beta.3",
"rspress-plugin-font-open-sans": "^1.0.0",
"rspress-plugin-sitemap": "^1.1.1",
"rspress-plugin-vercel-analytics": "^0.3.0"
},
"devDependencies": {
"@types/node": "^18",
"@types/react": "^18.2.64",
"typescript": "catalog:"
},
"engines": {
"node": ">=22"
}
}
22 changes: 20 additions & 2 deletions website/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as path from 'node:path';
import { pluginCallstackTheme } from '@callstack/rspress-theme/plugin';
import { pluginLlms } from '@rspress/plugin-llms';
import { pluginOpenGraph } from 'rsbuild-plugin-open-graph';
import { pluginFontOpenSans } from 'rspress-plugin-font-open-sans';
import pluginSitemap from 'rspress-plugin-sitemap';
import vercelAnalytics from 'rspress-plugin-vercel-analytics';
import { defineConfig } from 'rspress/config';

Expand All @@ -12,16 +14,17 @@ const EDIT_ROOT_URL = `https://github.com/callstack/repack/tree/main/website/${D

export default defineConfig({
root: path.join(__dirname, DOCS_ROOT),
outDir: 'build',
title: process.env.REPACK_DOC_VERSION
? `[${process.env.REPACK_DOC_VERSION}] Re.Pack`
: 'Re.Pack',
description: 'A toolkit to build your React Native application with Webpack.',
description:
'A modern build tool for React Native that brings the Rspack and webpack ecosystem to mobile React Native apps',
icon: '/img/favicon.ico',
logo: {
light: '/img/logo_light.svg',
dark: '/img/logo_dark.svg',
},
outDir: 'build',
markdown: {
checkDeadLinks: true,
codeHighlighter: 'prism',
Expand Down Expand Up @@ -71,6 +74,12 @@ export default defineConfig({
'global.__REPACK_DOC_LATEST_VERSION__': JSON.stringify(LATEST_VERSION),
},
},
output: {
distPath: {
// set explicitly for sitemap plugin
root: 'build',
},
},
plugins: [
pluginOpenGraph({
title: 'Re.Pack',
Expand Down Expand Up @@ -102,11 +111,20 @@ export default defineConfig({
? path.join(__dirname, DOCS_ROOT, 'styles', 'index.css')
: undefined,
plugins: [
// @ts-ignore
pluginSitemap({
domain: 'https://re-pack.dev',
}),
// @ts-ignore
pluginFontOpenSans(),
// @ts-ignore
vercelAnalytics(),
// @ts-ignore
pluginCallstackTheme(),
pluginLlms({
exclude: ({ page }) => {
return page.routePath.includes('404');
},
}),
],
});
4 changes: 2 additions & 2 deletions website/src/latest/api/plugins/hermes-bytecode.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
This plugin is converts JavaScript chunks into [Hermes](https://hermesengine.dev/) bytecode for production-level performance optimization.
It also converts related source maps to be compatible with bytecode bundles.

:::warning title="Remember to exclude the main bundle!"
:::warning Remember to exclude the main bundle!
If you enable Hermes in your project, your `index.bundle` file and it's source-map will be transformed by `react-native`.
You should exclude it from the plugin to avoid processing it twice.
:::

:::details title="Implementation details"
:::details Implementation details
This plugin will only transform assets that are emitted after the compilation. To ensure that asset is always emitted we disable the `compareBeforeEmit` option which is enabled by default in Rspack/webpack.

`compareBeforeEmit` option is used to skip emitting assets that are identical to the
Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/api/plugins/module-federation-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ which provides enhanced features like dynamic type hinting, manifest support and

This plugin is designed to configure Module Federation. It's an enhanced version of the standard Module Federation plugin that's specifically tailored for React Native environments.

:::info title="About configuration options"
:::info About configuration options

This documentation describes only Re.Pack-specific configuration options.

Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/api/plugins/module-federation-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

This plugin is designed to configure Module Federation 2.0. It's an enhanced version of the standard Module Federation plugin that's specifically tailored for React Native environments.

:::info title="About configuration options"
:::info About configuration options
This documentation describes only Re.Pack-specific configuration options. For the complete configuration reference, please see the [official Module Federation 2.0 documentation](https://module-federation.io/configure/index.html#configuration-overview).

All standard Module Federation 2.0 options are supported in addition to the options described below.
Expand Down Expand Up @@ -35,7 +35,7 @@ you should install the `@module-federation/runtime` package as well:

<PackageManagerTabs command="install @module-federation/runtime" />

:::tip title="Having trouble?"
:::tip Having trouble?
Check out the [official Module Federation 2.0 quick start guide](https://module-federation.io/guide/start/quick-start.html) for more information.
:::

Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/api/plugins/repack.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is the main plugin that enables React Native app development & bundling with Re.Pack and should be included in all of your configurations. It abstracts the configuration of other core internal plugins into one plugin.

:::warning title="About internal plugins"
:::warning About internal plugins

Plugins configured by the `RepackPlugin` are considered internal and there is no need to use or configure them directly. Their use is heavily discouraged and they are only included for the sake of completeness of the API.

Expand Down Expand Up @@ -47,7 +47,7 @@ Options to configure the logger's output. Setting this to `false` disables the L

Enable or disable logging to the console. When enabled, build progress, warnings, errors, and other messages will be displayed in the terminal.

:::tip title="Verbose logging"
:::tip Verbose logging

You can enable verbose logging by passing `--verbose` flag to either of CLI commands or by setting the `REPACK_VERBOSE` environment variable to `1` or `true`.

Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/api/runtime/script-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The `ScriptManager` is a low-level utility for managing script resolution, downloading, and execution in React Native applications. It's particularly useful when working with code splitting, dynamic imports, and Module Federation.

:::info title="Why is it called ScriptManager?"
:::info Why is it called ScriptManager?

It can be used to download, manage and execute external (either local or remote) JavaScript code.

Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/blog/repack-5-release.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ One of the most exciting features in Re.Pack 5 is the introduction of first-clas

<img src="/img/blog/rspack-bench.png" alt="Rspack's own benchmark showing 3-20x improvement for web projects compared to Webpack. For React Native and Re.Pack it's consistently 5x faster across the board" />

:::note title="Rspack's own benchmark showing 3-20x improvement for web projects compared to Webpack. For React Native and Re.Pack it's consistently 5x faster across the board"
:::note Rspack's own benchmark showing 3-20x improvement for web projects compared to Webpack. For React Native and Re.Pack it's consistently 5x faster across the board
:::

Most projects can switch with minimal changes to their configuration files. We've carefully tuned our Rspack integration to work with React Native's specific requirements, ensuring you get all the performance benefits without compatibility issues.
Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/docs/features/module-federation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Module Federation

:::warning title="Notice:"
:::warning Notice:
The documentation for Re.Pack 5 is currently under development and some of the pages aren't ready yet.

Please use [latest stable version of Re.Pack 4.x documentation](https://re-pack.dev/docs/getting-started) for now.
Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/docs/features/module-resolution.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Module resolution

:::warning title="Notice:"
:::warning Notice:
The documentation for Re.Pack 5 is currently under development and some of the pages aren't ready yet.

Please use [latest stable version of Re.Pack 4.x documentation](https://re-pack.dev/docs/getting-started) for now.
Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/features/reanimated.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PackageManagerTabs } from 'rspress/theme';

Re.Pack provides first-class support for [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/) through a dedicated plugin that simplifies integration and optimizes build performance.

:::warning title="This plugin is primarily intended for Rspack users."
:::warning This plugin is primarily intended for Rspack users.

The main purpose of this plugin is to limit the **build performance impact** of the `react-native-reanimated` babel plugin.

Expand Down Expand Up @@ -37,7 +37,7 @@ Our plugin takes a smarter approach by only applying the Reanimated transformati

In simple terms: we make your builds faster by only doing the heavy Reanimated processing where it's actually needed.

:::note title="Credits"
:::note Credits
Shoutout to [Nate Wienert](https://x.com/natebirdman) who came up with a similar approach in [one.dev](https://one.dev) - his work was the inspiration for this plugin.
:::

Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/docs/getting-started/bundlers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rspack & webpack

:::warning title="Notice:"
:::warning Notice:
The documentation for Re.Pack 5 is currently under development and some of the pages aren't ready yet.

Please use [latest stable version of Re.Pack 4.x documentation](https://re-pack.dev/docs/getting-started) for now.
Expand Down
2 changes: 1 addition & 1 deletion website/src/latest/docs/getting-started/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Therefore, we need to make changes to webpack configuration and change how and w

So to answer the question:

:::info{title="Re.Pack is what makes webpack and webpack-produced bundle usable in React Native application."}
:::info Re.Pack is what makes webpack and webpack-produced bundle usable in React Native application.
:::

## Why & when
Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/getting-started/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To create a new React Native project with Re.Pack or adapt an existing one:

In case the command above didn't work for any reason, you can follow the manual migration guide [here](/docs/migration-guides/metro).

:::tip title="The defaults work well for most projects"
:::tip The defaults work well for most projects
If you need custom settings (like additional loaders or plugins), check out our [configuration guide](/docs/guides/configuration).
:::

Expand Down Expand Up @@ -58,7 +58,7 @@ When you are building the release version of your application, Re.Pack will be p

To learn about `bundle` command, check out the [bundle command documentation](/api/cli/bundle.mdx).

:::tip title="🎉 Congratulations!"
:::tip 🎉 Congratulations!

You've successfully set up Re.Pack in your project. We highly recommend to check out the following:

Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/guides/bundle-analysis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { PackageManagerTabs, Tabs, Tab } from 'rspress/theme';

### Usage

:::danger title="Only for development"
:::danger Only for development
Please do not use Rsdoctor in production version.

The `process.env.RSDOCTOR` is used to conditionally enable the plugin just for the development environment.
Expand Down Expand Up @@ -79,7 +79,7 @@ Use the `RSDOCTOR` environment variable when running the build:
RSDOCTOR=true npx react-native bundle
```

:::tip title="Specific platform analysis"
:::tip Specific platform analysis
For better analysis results, it's recommended to run a single platform build using the `--platform` option:

```bash
Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/guides/deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ npx create-zephyr-apps@latest
2. A Zephyr Cloud account: sign up at [Zephyr Cloud](https://app.zephyr-cloud.io?ref=repack) if you haven't already.


:::info title="Related docs"
:::info Related docs

For more details related to `create-zephyr-apps` CLI, please refer to the [Zephyr Cloud's documentation for React Native, Re.Pack and Module Federation](https://docs.zephyr-cloud.io/recipes/repack-mf).

Expand Down Expand Up @@ -83,7 +83,7 @@ The deploy URL is instantly sharable, available and able to be used, or auto-res



:::tip title="Learn more about Zephyr Cloud"
:::tip Learn more about Zephyr Cloud

- [Website](https://zephyr-cloud.io)
- [Documentation](https://docs.zephyr-cloud.io)
Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/guides/inline-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Common examples of such use cases are:
- Using assets inside of [Module Federation remotes](/docs/features/module-federation) where you can't have assets extracted and shipped with the host app bundle.
- Out-of-tree platforms that don't support static assets in a similar way as React Native on iOS/Android does or don't support static assets at all.

:::tip title="Use sparingly and only when necessary"
:::tip Use sparingly and only when necessary

Inlining assets into the bundle makes the **bundle size larger** and increases the **initial startup time** of an app. It's most noticable when you inline an asset which has 3 scales (e.g. `@1x`, `@2x` and `@3x`). In that scenario, all of the scales will be inlined into the bundle since it's not possible to determine which scale is needed at runtime.

Expand Down Expand Up @@ -93,7 +93,7 @@ module.exports = {
};
```

:::tip title="Learn more about loader rules"
:::tip Learn more about loader rules

You can read more about loader rules and how to configure them in:

Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/guides/remote-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ instead of bundling them directly into your application. When working with Modul
this is the recommended approach to handling the assets in federated modules, as inlining
the assets causes your bundle size to increase dramatically.

:::tip title="Use remote assets only in production"
:::tip Use remote assets only in production
During development, it's best to disable remote assets and load them locally. When you're ready to move to production, you can use `enabled: true` and then upload the assets to the CDN of your choosing.
:::

Expand Down Expand Up @@ -79,7 +79,7 @@ type Source = {

The `uri` prop will have a value of an URL that's constructed by joining `publicPath`, 'assets' and local path to the asset together. If `publicPath` is set to https://example.com and the local path to the asset is logo.png, then the resulting `uri` value would be: `https://example.com/assets/images/logo.png`.

:::info title="Scaled assets are fully supported"
:::info Scaled assets are fully supported

The asset will resolve to proper scale in runtime by constructing a relevant URL with scale suffix at the end of it.

Expand Down
4 changes: 2 additions & 2 deletions website/src/latest/docs/migration-guides/metro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Pick one of the templates below and create configuration file in the root direct



:::info title="Go with ESM config by default"
:::info Go with ESM config by default

We recommend to use ESM version of Rspack/webpack config with the `.mjs` extension. However, Re.Pack also supports ESM under `.js` and CJS variant under `.js` and `.cjs` extensions. Check our [templates](https://github.com/callstack/repack/blob/main/templates/) for CJS and ESM variants as well as the documentation on [Configuration](/docs/guides/configuration) to see the list of all available Rspack/webpack config location and extensions.

Expand Down Expand Up @@ -137,7 +137,7 @@ npx pod-install

This will install all the necessary iOS dependencies for your project, including the Re.Pack native module.

:::tip title="🎉 Congratulations!"
:::tip 🎉 Congratulations!

You've successfully set up Re.Pack in your project. We highly recommend to check out the following:

Expand Down
Loading