@modern-js/plugin-ssg 1.2.12 → 1.2.15-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @modern-js/plugin-ssg
2
2
 
3
+ ## 1.2.15-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9cd364e06]
8
+ - Updated dependencies [a90bc96bd]
9
+ - @modern-js/utils@1.7.9-alpha.0
10
+
11
+ ## 1.2.14
12
+
13
+ ### Patch Changes
14
+
15
+ - a1198d509: feat: bump babel 7.18.0
16
+
17
+ ## 1.2.13
18
+
19
+ ### Patch Changes
20
+
21
+ - 6c8ab42dd: optimize whether to do SSR bundle
22
+
3
23
  ## 1.2.12
4
24
 
5
25
  ### Patch Changes
@@ -106,11 +106,11 @@ export default (() => ({
106
106
  } else {
107
107
  // Unless entryOptions is set to false
108
108
  // the default behavior is to add all file-based routes
109
- if (entryOptions === false) {
109
+ if (!entryOptions) {
110
110
  return;
111
111
  }
112
112
 
113
- if (!entryOptions || entryOptions === true) {
113
+ if (entryOptions === true) {
114
114
  entryOptions = {
115
115
  preventDefault: [],
116
116
  routes: [],
@@ -131,7 +131,7 @@ export const standardOptions = (ssgOptions, entrypoints) => {
131
131
 
132
132
  return false;
133
133
  };
134
- export const openRouteSSR = routes => routes.map(ssgRoute => _objectSpread(_objectSpread({}, ssgRoute), {}, {
135
- isSSR: true,
134
+ export const openRouteSSR = (routes, entries = []) => routes.map(ssgRoute => _objectSpread(_objectSpread({}, ssgRoute), {}, {
135
+ isSSR: entries.includes(ssgRoute.entryName),
136
136
  bundle: `${SERVER_BUNDLE_DIRECTORY}/${ssgRoute.entryName}.js`
137
137
  }));
@@ -6,7 +6,8 @@ import { CLOSE_SIGN } from "./consts";
6
6
  export const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirectory) => new Promise((resolve, reject) => {
7
7
  // this side of the shallow copy of a route for subsequent render processing, to prevent the modification of the current field
8
8
  // manually enable the server-side rendering configuration for all routes that require SSG
9
- const backup = openRouteSSR(pageRoutes);
9
+ const entries = ssgRoutes.map(route => route.entryName);
10
+ const backup = openRouteSSR(pageRoutes, entries);
10
11
  const total = backup.concat(apiRoutes);
11
12
  const cp = childProcess.fork(path.join(__dirname, 'process'), {
12
13
  cwd: appDirectory,
@@ -124,11 +124,11 @@ var _default = () => ({
124
124
  } else {
125
125
  // Unless entryOptions is set to false
126
126
  // the default behavior is to add all file-based routes
127
- if (entryOptions === false) {
127
+ if (!entryOptions) {
128
128
  return;
129
129
  }
130
130
 
131
- if (!entryOptions || entryOptions === true) {
131
+ if (entryOptions === true) {
132
132
  entryOptions = {
133
133
  preventDefault: [],
134
134
  routes: [],
@@ -165,8 +165,8 @@ const standardOptions = (ssgOptions, entrypoints) => {
165
165
 
166
166
  exports.standardOptions = standardOptions;
167
167
 
168
- const openRouteSSR = routes => routes.map(ssgRoute => _objectSpread(_objectSpread({}, ssgRoute), {}, {
169
- isSSR: true,
168
+ const openRouteSSR = (routes, entries = []) => routes.map(ssgRoute => _objectSpread(_objectSpread({}, ssgRoute), {}, {
169
+ isSSR: entries.includes(ssgRoute.entryName),
170
170
  bundle: `${_utils.SERVER_BUNDLE_DIRECTORY}/${ssgRoute.entryName}.js`
171
171
  }));
172
172
 
@@ -20,7 +20,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  const createServer = (api, ssgRoutes, pageRoutes, apiRoutes, options, appDirectory) => new Promise((resolve, reject) => {
21
21
  // this side of the shallow copy of a route for subsequent render processing, to prevent the modification of the current field
22
22
  // manually enable the server-side rendering configuration for all routes that require SSG
23
- const backup = (0, _util.openRouteSSR)(pageRoutes);
23
+ const entries = ssgRoutes.map(route => route.entryName);
24
+ const backup = (0, _util.openRouteSSR)(pageRoutes, entries);
24
25
  const total = backup.concat(apiRoutes);
25
26
 
26
27
  const cp = _child_process.default.fork(_path.default.join(__dirname, 'process'), {
@@ -9,7 +9,7 @@ export declare const readJSONSpec: (dir: string) => ModernRoute[];
9
9
  export declare const writeJSONSpec: (dir: string, routes: ModernRoute[]) => void;
10
10
  export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
11
11
  export declare const standardOptions: (ssgOptions: SSGConfig, entrypoints: EntryPoint[]) => false | SSGMultiEntryOptions;
12
- export declare const openRouteSSR: (routes: ModernRoute[]) => {
12
+ export declare const openRouteSSR: (routes: ModernRoute[], entries?: string[]) => {
13
13
  isSSR: boolean;
14
14
  bundle: string;
15
15
  entryName?: string | undefined;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.2.12",
14
+ "version": "1.2.15-alpha.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -54,27 +54,28 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@babel/runtime": "^7",
58
- "@modern-js/utils": "^1.7.3",
57
+ "@babel/runtime": "^7.18.0",
58
+ "@modern-js/utils": "^1.7.9-alpha.0",
59
59
  "node-mocks-http": "^1.10.1",
60
60
  "normalize-path": "^3.0.0",
61
61
  "portfinder": "^1.0.28",
62
62
  "react-router-dom": "^5.2.1"
63
63
  },
64
64
  "devDependencies": {
65
- "@modern-js/types": "1.5.3",
66
- "@modern-js/prod-server": "1.1.5",
65
+ "@modern-js/types": "1.5.5-alpha.0",
66
+ "@modern-js/prod-server": "1.1.9-alpha.0",
67
67
  "@types/jest": "^27",
68
68
  "@types/node": "^14",
69
69
  "@types/react": "^17",
70
70
  "@types/react-dom": "^17",
71
71
  "@types/react-router": "^5.1.16",
72
72
  "@types/react-router-dom": "^5.1.8",
73
- "typescript": "^4",
74
- "@modern-js/core": "1.10.2",
73
+ "@modern-js/core": "1.12.2-alpha.0",
75
74
  "@scripts/build": "0.0.0",
76
- "jest": "^27",
77
- "@scripts/jest-config": "0.0.0"
75
+ "@scripts/jest-config": "0.0.0",
76
+ "react": "^17",
77
+ "typescript": "^4",
78
+ "jest": "^27"
78
79
  },
79
80
  "sideEffects": false,
80
81
  "modernConfig": {
@@ -103,7 +104,8 @@
103
104
  "files": [
104
105
  "src/**/*",
105
106
  "tsconfig.json",
106
- "package.json"
107
+ "package.json",
108
+ "tests/**/*"
107
109
  ],
108
110
  "output": []
109
111
  }