@vercel/microfrontends 1.4.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/microfrontends
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 10b74ed: Route next/image requests to the correct microfrontends application in the local development proxy.
8
+
3
9
  ## 1.4.0
4
10
 
5
11
  ### Minor Changes
package/dist/bin/cli.cjs CHANGED
@@ -30,7 +30,7 @@ var import_env = require("@next/env");
30
30
  // package.json
31
31
  var package_default = {
32
32
  name: "@vercel/microfrontends",
33
- version: "1.4.0",
33
+ version: "1.4.1",
34
34
  private: false,
35
35
  description: "Defines configuration and utilities for microfrontends development",
36
36
  keywords: [
@@ -2175,7 +2175,7 @@ var ProxyRequestRouter = class {
2175
2175
  path: path7,
2176
2176
  url,
2177
2177
  app: application
2178
- }) || this.checkNextOriginalFrame({ url, referer, applications }) || this.checkNextSourceMap({ url });
2178
+ }) || this.checkNextOriginalFrame({ url, referer, applications }) || this.checkNextSourceMap({ url }) || this.checkNextImage({ url, applications });
2179
2179
  if (builtInRewrite) {
2180
2180
  return builtInRewrite;
2181
2181
  }
@@ -2261,9 +2261,7 @@ var ProxyRequestRouter = class {
2261
2261
  path: `${url.pathname}${url.search}`
2262
2262
  } : null;
2263
2263
  }
2264
- checkNextSourceMap({
2265
- url
2266
- }) {
2264
+ checkNextSourceMap({ url }) {
2267
2265
  const isSourceMap = (0, import_path_to_regexp3.pathToRegexp)("/__nextjs_source-map").test(url.pathname);
2268
2266
  if (!isSourceMap) {
2269
2267
  return null;
@@ -2280,6 +2278,32 @@ var ProxyRequestRouter = class {
2280
2278
  path: `${url.pathname}${url.search}`
2281
2279
  };
2282
2280
  }
2281
+ checkNextImage({
2282
+ url,
2283
+ applications
2284
+ }) {
2285
+ const isNextImage = (0, import_path_to_regexp3.pathToRegexp)("/_next/image").test(url.pathname);
2286
+ if (!isNextImage) {
2287
+ return null;
2288
+ }
2289
+ const imageUrl = url.searchParams.get("url");
2290
+ if (!imageUrl) {
2291
+ mfeDebug("no url parameter found in _next/image request");
2292
+ return null;
2293
+ }
2294
+ const decodedPath = decodeURIComponent(imageUrl);
2295
+ const imageURL = new import_node_url.URL(`http://example.com${decodedPath}`);
2296
+ const imageApp = this.findMatchingApplication({
2297
+ path: decodedPath,
2298
+ url: imageURL,
2299
+ applications
2300
+ });
2301
+ mfeDebug(`routing nextjs image request to ${imageApp?.application}`);
2302
+ return imageApp ? {
2303
+ ...imageApp,
2304
+ path: `${url.pathname}${url.search}`
2305
+ } : null;
2306
+ }
2283
2307
  isDefaultAppLocal() {
2284
2308
  const defaultApp = this.config.getDefaultApplication();
2285
2309
  return Boolean(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/microfrontends",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "private": false,
5
5
  "description": "Defines configuration and utilities for microfrontends development",
6
6
  "keywords": [