@vercel/microfrontends 1.4.0-canary.0 → 1.4.0-canary.2

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/dist/bin/cli.cjs +7 -4
  3. package/dist/config.cjs +6 -3
  4. package/dist/config.cjs.map +1 -1
  5. package/dist/config.d.ts +1 -1
  6. package/dist/config.js +6 -3
  7. package/dist/config.js.map +1 -1
  8. package/dist/experimental/sveltekit.cjs +6 -3
  9. package/dist/experimental/sveltekit.cjs.map +1 -1
  10. package/dist/experimental/sveltekit.js +6 -3
  11. package/dist/experimental/sveltekit.js.map +1 -1
  12. package/dist/experimental/vite.cjs +6 -3
  13. package/dist/experimental/vite.cjs.map +1 -1
  14. package/dist/experimental/vite.js +6 -3
  15. package/dist/experimental/vite.js.map +1 -1
  16. package/dist/microfrontends/server.cjs +6 -3
  17. package/dist/microfrontends/server.cjs.map +1 -1
  18. package/dist/microfrontends/server.js +6 -3
  19. package/dist/microfrontends/server.js.map +1 -1
  20. package/dist/next/client.cjs +1 -1
  21. package/dist/next/client.cjs.map +1 -1
  22. package/dist/next/client.js +1 -1
  23. package/dist/next/client.js.map +1 -1
  24. package/dist/next/config.cjs +19 -6
  25. package/dist/next/config.cjs.map +1 -1
  26. package/dist/next/config.js +19 -6
  27. package/dist/next/config.js.map +1 -1
  28. package/dist/next/middleware.cjs +6 -3
  29. package/dist/next/middleware.cjs.map +1 -1
  30. package/dist/next/middleware.js +6 -3
  31. package/dist/next/middleware.js.map +1 -1
  32. package/dist/next/testing.cjs +6 -3
  33. package/dist/next/testing.cjs.map +1 -1
  34. package/dist/next/testing.js +6 -3
  35. package/dist/next/testing.js.map +1 -1
  36. package/dist/utils/mfe-port.cjs +6 -3
  37. package/dist/utils/mfe-port.cjs.map +1 -1
  38. package/dist/utils/mfe-port.js +6 -3
  39. package/dist/utils/mfe-port.js.map +1 -1
  40. package/package.json +1 -1
@@ -579,6 +579,9 @@ var validateDeprecatedFields = (config) => {
579
579
  );
580
580
  }
581
581
  if (application.projectId) {
582
+ errors.push(
583
+ `Application '${applicationId}' cannot contain deprecated field 'projectId'. If the application ID matches the Vercel project name, then please remove the 'projectId' field. Otherwise, either update the application ID / Vercel project name to match, or set the 'packageName' field to the name of the package.json name.`
584
+ );
582
585
  }
583
586
  }
584
587
  if (errors.length) {
@@ -927,12 +930,12 @@ var MicrofrontendConfigIsomorphic = class {
927
930
  return false;
928
931
  }
929
932
  }
930
- getApplicationByProjectId(projectId) {
931
- if (this.defaultApplication.projectId === projectId) {
933
+ getApplicationByProjectName(projectName) {
934
+ if (this.defaultApplication.name === projectName) {
932
935
  return this.defaultApplication;
933
936
  }
934
937
  return Object.values(this.childApplications).find(
935
- (app) => app.projectId === projectId
938
+ (app) => app.name === projectName
936
939
  );
937
940
  }
938
941
  /**
@@ -1675,7 +1678,6 @@ var SortChunksPlugin = class {
1675
1678
  };
1676
1679
 
1677
1680
  // src/next/config/transforms/webpack.ts
1678
- var cjsRequire = typeof __require === "function" ? __require : createRequire(import.meta.url);
1679
1681
  var nextVersion = getNextJsVersion();
1680
1682
  function transform6(args) {
1681
1683
  const useDefineServer = args.opts?.preferWebpackEnvironmentPlugin ? false : semver.gte(nextVersion, "15.4.0-canary.41");
@@ -1734,8 +1736,15 @@ function transform6(args) {
1734
1736
  };
1735
1737
  }
1736
1738
  function getNextJsVersion() {
1739
+ const cjsRequire = (
1740
+ // This is used so we can use `require.resolve` to find the Next.js package:
1741
+ // - `import.meta.resolve` is not available in CJS or early Node.js versions.
1742
+ // - tsup/esbuild don't generate import meta urls for CJS modules, so use this as
1743
+ // a test to see if we're running in ESM. Referencing `import.meta.url` is
1744
+ // still grammatically valid in CJS because esbuild transforms it.
1745
+ typeof import.meta.url === "string" ? createRequire(import.meta.url) : __require
1746
+ );
1737
1747
  const parsedNextPackageJson = JSON.parse(
1738
- // `import.meta.url` is not available in CJS or early Node.js versions
1739
1748
  fs7.readFileSync(cjsRequire.resolve("next/package.json"), "utf8")
1740
1749
  );
1741
1750
  if (typeof parsedNextPackageJson !== "object" || parsedNextPackageJson === null) {
@@ -1841,7 +1850,11 @@ function withMicrofrontends(nextConfig, opts) {
1841
1850
  throw e;
1842
1851
  }
1843
1852
  }
1844
- displayLocalProxyInfo(microfrontends.config.getLocalProxyPort());
1853
+ const localProxyPort = microfrontends.config.getLocalProxyPort();
1854
+ if (typeof localProxyPort === "number") {
1855
+ process.env.MFE_LOCAL_PROXY_PORT = localProxyPort.toString();
1856
+ }
1857
+ displayLocalProxyInfo(localProxyPort);
1845
1858
  return next;
1846
1859
  }
1847
1860
  export {