@vercel/microfrontends 1.0.1-canary.0 → 1.0.1-canary.1
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/bin/cli.cjs +103 -18
- package/dist/experimental/sveltekit.cjs.map +1 -0
- package/dist/experimental/sveltekit.js.map +1 -0
- package/dist/experimental/vite.cjs +1745 -0
- package/dist/experimental/vite.cjs.map +1 -0
- package/dist/experimental/vite.d.ts +29 -0
- package/dist/experimental/vite.js +1710 -0
- package/dist/experimental/vite.js.map +1 -0
- package/dist/next/config.cjs +17 -10
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +17 -10
- package/dist/next/config.js.map +1 -1
- package/dist/next/middleware.cjs +30 -5
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.js +30 -5
- package/dist/next/middleware.js.map +1 -1
- package/package.json +21 -9
- package/dist/sveltekit.cjs.map +0 -1
- package/dist/sveltekit.js.map +0 -1
- /package/dist/{sveltekit.cjs → experimental/sveltekit.cjs} +0 -0
- /package/dist/{sveltekit.d.ts → experimental/sveltekit.d.ts} +0 -0
- /package/dist/{sveltekit.js → experimental/sveltekit.js} +0 -0
package/dist/next/config.js
CHANGED
|
@@ -1702,27 +1702,34 @@ function transform2(args) {
|
|
|
1702
1702
|
};
|
|
1703
1703
|
}
|
|
1704
1704
|
|
|
1705
|
+
// src/next/utils/route-to-local-proxy.ts
|
|
1706
|
+
function routeToLocalProxy() {
|
|
1707
|
+
const isDevEnv = (process.env.VERCEL_ENV ?? "development") === "development";
|
|
1708
|
+
return isDevEnv && Boolean(process.env.TURBO_TASK_HAS_MFE_PROXY);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1705
1711
|
// src/next/config/transforms/redirects.ts
|
|
1706
1712
|
function transform3(args) {
|
|
1707
1713
|
const { next, microfrontend, opts } = args;
|
|
1708
1714
|
const isProduction2 = opts?.isProduction ?? false;
|
|
1709
|
-
const
|
|
1710
|
-
const requireLocalProxyHeader = !isProduction2 && isDevEnv && Boolean(process.env.TURBO_TASK_HAS_MFE_PROXY) && !process.env.MFE_DISABLE_LOCAL_PROXY_REWRITE;
|
|
1715
|
+
const requireLocalProxyHeader = routeToLocalProxy() && !isProduction2 && !process.env.MFE_DISABLE_LOCAL_PROXY_REWRITE;
|
|
1711
1716
|
if (requireLocalProxyHeader) {
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1717
|
+
const proxyRedirects = [
|
|
1718
|
+
{
|
|
1719
|
+
source: "/:path*",
|
|
1720
|
+
destination: `http://localhost:${microfrontend.getLocalProxyPort()}/:path*`,
|
|
1721
|
+
permanent: false,
|
|
1722
|
+
missing: [{ type: "header", key: "x-vercel-mfe-local-proxy-origin" }]
|
|
1723
|
+
}
|
|
1724
|
+
];
|
|
1718
1725
|
if (next.redirects && typeof next.redirects === "function") {
|
|
1719
1726
|
const originalRedirectsFn = next.redirects;
|
|
1720
1727
|
next.redirects = async () => {
|
|
1721
1728
|
const originalRedirects = await originalRedirectsFn();
|
|
1722
|
-
return [
|
|
1729
|
+
return [...proxyRedirects, ...originalRedirects];
|
|
1723
1730
|
};
|
|
1724
1731
|
} else {
|
|
1725
|
-
next.redirects = async () =>
|
|
1732
|
+
next.redirects = async () => proxyRedirects;
|
|
1726
1733
|
}
|
|
1727
1734
|
}
|
|
1728
1735
|
return { next };
|