@modern-js/plugin-ssg 2.56.1 → 2.57.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.
package/dist/cjs/index.js CHANGED
@@ -51,7 +51,7 @@ const ssgPlugin = () => ({
51
51
  return {
52
52
  modifyFileSystemRoutes({ entrypoint, routes }) {
53
53
  const { entryName } = entrypoint;
54
- const flattedRoutes = (0, import_util.flattenRoutes)(routes);
54
+ const flattedRoutes = (0, import_util.flattenRoutes)((0, import_utils.filterRoutesForServer)(routes));
55
55
  agreedRouteMap[entryName] = flattedRoutes;
56
56
  return {
57
57
  entrypoint,
@@ -67,8 +67,8 @@ const ssgPlugin = () => ({
67
67
  const ssgOptions = (Array.isArray(ssg) ? ssg.pop() : ssg) || true;
68
68
  const buildDir = import_path.default.join(appDirectory, outputPath);
69
69
  const routes = (0, import_util.readJSONSpec)(buildDir);
70
- const pageRoutes = routes.filter((route) => !route.isApi);
71
- const apiRoutes = routes.filter((route) => route.isApi);
70
+ const pageRoutes = routes.filter((route) => route.isSPA);
71
+ const apiRoutes = routes.filter((route) => !route.isSPA);
72
72
  if (pageRoutes.length === 0) {
73
73
  return;
74
74
  }
package/dist/esm/index.js CHANGED
@@ -3,7 +3,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
5
  import path from "path";
6
- import { logger } from "@modern-js/utils";
6
+ import { filterRoutesForServer, logger } from "@modern-js/utils";
7
7
  import { generatePath } from "react-router-dom";
8
8
  import { flattenRoutes, formatOutput, isDynamicUrl, readJSONSpec, standardOptions, writeJSONSpec } from "./libs/util";
9
9
  import { createServer } from "./server";
@@ -23,7 +23,7 @@ var ssgPlugin = function() {
23
23
  modifyFileSystemRoutes: function modifyFileSystemRoutes(param) {
24
24
  var entrypoint = param.entrypoint, routes = param.routes;
25
25
  var entryName = entrypoint.entryName;
26
- var flattedRoutes = flattenRoutes(routes);
26
+ var flattedRoutes = flattenRoutes(filterRoutesForServer(routes));
27
27
  agreedRouteMap[entryName] = flattedRoutes;
28
28
  return {
29
29
  entrypoint,
@@ -45,10 +45,10 @@ var ssgPlugin = function() {
45
45
  buildDir = path.join(appDirectory, outputPath);
46
46
  routes = readJSONSpec(buildDir);
47
47
  pageRoutes = routes.filter(function(route) {
48
- return !route.isApi;
48
+ return route.isSPA;
49
49
  });
50
50
  apiRoutes = routes.filter(function(route) {
51
- return route.isApi;
51
+ return !route.isSPA;
52
52
  });
53
53
  if (pageRoutes.length === 0) {
54
54
  return [
@@ -1,5 +1,5 @@
1
1
  import path from "path";
2
- import { logger } from "@modern-js/utils";
2
+ import { filterRoutesForServer, logger } from "@modern-js/utils";
3
3
  import { generatePath } from "react-router-dom";
4
4
  import { flattenRoutes, formatOutput, isDynamicUrl, readJSONSpec, standardOptions, writeJSONSpec } from "./libs/util";
5
5
  import { createServer } from "./server";
@@ -17,7 +17,7 @@ const ssgPlugin = () => ({
17
17
  return {
18
18
  modifyFileSystemRoutes({ entrypoint, routes }) {
19
19
  const { entryName } = entrypoint;
20
- const flattedRoutes = flattenRoutes(routes);
20
+ const flattedRoutes = flattenRoutes(filterRoutesForServer(routes));
21
21
  agreedRouteMap[entryName] = flattedRoutes;
22
22
  return {
23
23
  entrypoint,
@@ -33,8 +33,8 @@ const ssgPlugin = () => ({
33
33
  const ssgOptions = (Array.isArray(ssg) ? ssg.pop() : ssg) || true;
34
34
  const buildDir = path.join(appDirectory, outputPath);
35
35
  const routes = readJSONSpec(buildDir);
36
- const pageRoutes = routes.filter((route) => !route.isApi);
37
- const apiRoutes = routes.filter((route) => route.isApi);
36
+ const pageRoutes = routes.filter((route) => route.isSPA);
37
+ const apiRoutes = routes.filter((route) => !route.isSPA);
38
38
  if (pageRoutes.length === 0) {
39
39
  return;
40
40
  }
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.56.1",
18
+ "version": "2.57.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -63,8 +63,8 @@
63
63
  "normalize-path": "3.0.0",
64
64
  "portfinder": "^1.0.28",
65
65
  "@swc/helpers": "0.5.3",
66
- "@modern-js/utils": "2.56.1",
67
- "@modern-js/prod-server": "2.56.1"
66
+ "@modern-js/utils": "2.57.0",
67
+ "@modern-js/prod-server": "2.57.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react-router-dom": ">=5.1.2"
@@ -82,10 +82,10 @@
82
82
  "react-dom": "^18",
83
83
  "react-router-dom": "6.22.0",
84
84
  "typescript": "^5",
85
- "@scripts/build": "2.56.1",
86
- "@modern-js/app-tools": "2.56.1",
87
- "@scripts/jest-config": "2.56.1",
88
- "@modern-js/types": "2.56.1"
85
+ "@modern-js/app-tools": "2.57.0",
86
+ "@modern-js/types": "2.57.0",
87
+ "@scripts/jest-config": "2.57.0",
88
+ "@scripts/build": "2.57.0"
89
89
  },
90
90
  "sideEffects": false,
91
91
  "publishConfig": {