@vercel/microfrontends 1.2.4 → 1.3.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.
Files changed (40) hide show
  1. package/README.md +5 -1
  2. package/dist/bin/cli.cjs +1 -8
  3. package/dist/config.d.ts +10 -3
  4. package/dist/experimental/sveltekit.cjs.map +1 -1
  5. package/dist/experimental/sveltekit.js.map +1 -1
  6. package/dist/experimental/vite.cjs.map +1 -1
  7. package/dist/experimental/vite.js.map +1 -1
  8. package/dist/microfrontends/server.cjs +4 -2
  9. package/dist/microfrontends/server.cjs.map +1 -1
  10. package/dist/microfrontends/server.d.ts +13 -4
  11. package/dist/microfrontends/server.js +2 -1
  12. package/dist/microfrontends/server.js.map +1 -1
  13. package/dist/next/config.cjs +23 -28
  14. package/dist/next/config.cjs.map +1 -1
  15. package/dist/next/config.js +23 -28
  16. package/dist/next/config.js.map +1 -1
  17. package/dist/next/middleware.cjs +117 -69
  18. package/dist/next/middleware.cjs.map +1 -1
  19. package/dist/next/middleware.d.ts +4 -2
  20. package/dist/next/middleware.js +117 -69
  21. package/dist/next/middleware.js.map +1 -1
  22. package/dist/next/testing.cjs +6 -0
  23. package/dist/next/testing.cjs.map +1 -1
  24. package/dist/next/testing.d.ts +2 -3
  25. package/dist/next/testing.js +6 -0
  26. package/dist/next/testing.js.map +1 -1
  27. package/dist/overrides.d.ts +3 -3
  28. package/dist/schema.d.ts +2 -2
  29. package/dist/{types-c9f15465.d.ts → types-ab31c948.d.ts} +1 -1
  30. package/dist/{types-bee19651.d.ts → types-d3cb74a6.d.ts} +1 -1
  31. package/dist/utils/mfe-port.cjs.map +1 -1
  32. package/dist/utils/mfe-port.js.map +1 -1
  33. package/dist/validation.d.ts +1 -1
  34. package/package.json +1 -8
  35. package/dist/next/endpoints.cjs +0 -154
  36. package/dist/next/endpoints.cjs.map +0 -1
  37. package/dist/next/endpoints.d.ts +0 -68
  38. package/dist/next/endpoints.js +0 -127
  39. package/dist/next/endpoints.js.map +0 -1
  40. package/dist/types-b970b583.d.ts +0 -11
@@ -1639,6 +1639,28 @@ function transform5(args) {
1639
1639
  };
1640
1640
  }
1641
1641
 
1642
+ // src/next/config/plugins/sort-chunks.ts
1643
+ var SortChunksPlugin = class {
1644
+ apply(compiler) {
1645
+ compiler.hooks.compilation.tap("SortChunksPlugin", (compilation) => {
1646
+ compilation.hooks.optimizeChunks.tap("SortChunksPlugin", (chunks) => {
1647
+ const sortedChunks = Array.from(chunks).sort((a, b) => {
1648
+ if (a.name && b.name) {
1649
+ return a.name.localeCompare(b.name);
1650
+ }
1651
+ return (String(a.id) || "").localeCompare(String(b.id) || "");
1652
+ });
1653
+ Array.from(chunks).forEach((chunk) => {
1654
+ compilation.chunks.delete(chunk);
1655
+ });
1656
+ sortedChunks.forEach((chunk) => {
1657
+ compilation.chunks.add(chunk);
1658
+ });
1659
+ });
1660
+ });
1661
+ }
1662
+ };
1663
+
1642
1664
  // src/next/config/transforms/webpack.ts
1643
1665
  function transform6(args) {
1644
1666
  const { next, microfrontend, opts } = args;
@@ -1675,34 +1697,7 @@ function transform6(args) {
1675
1697
  if (opts?.supportPagesRouter) {
1676
1698
  config.optimization.moduleIds = "deterministic";
1677
1699
  config.optimization.chunkIds = "deterministic";
1678
- config.plugins.push({
1679
- apply: (compiler) => {
1680
- compiler.hooks.compilation.tap(
1681
- "SortChunksPlugin",
1682
- (compilation) => {
1683
- compilation.hooks.optimizeChunks.tap(
1684
- "SortChunksPlugin",
1685
- (chunks) => {
1686
- const sortedChunks = Array.from(chunks).sort((a, b) => {
1687
- if (a.name && b.name) {
1688
- return a.name.localeCompare(b.name);
1689
- }
1690
- return (String(a.id) || "").localeCompare(
1691
- String(b.id) || ""
1692
- );
1693
- });
1694
- Array.from(chunks).forEach((chunk) => {
1695
- compilation.chunks.delete(chunk);
1696
- });
1697
- sortedChunks.forEach((chunk) => {
1698
- compilation.chunks.add(chunk);
1699
- });
1700
- }
1701
- );
1702
- }
1703
- );
1704
- }
1705
- });
1700
+ config.plugins.push(new SortChunksPlugin());
1706
1701
  }
1707
1702
  return config;
1708
1703
  }