@modern-js/plugin-ssg 2.58.0 → 2.58.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.
@@ -42,7 +42,7 @@ process.on("message", async (chunk) => {
42
42
  config: options,
43
43
  appContext,
44
44
  routes,
45
- plugins: (0, import_prod_server.loadServerPlugins)(plugins, appContext.appDirectory || distDirectory),
45
+ plugins: await (0, import_prod_server.loadServerPlugins)(plugins, appContext.appDirectory || distDirectory),
46
46
  staticGenerate: true
47
47
  };
48
48
  nodeServer = await (0, import_prod_server.createProdServer)(serverOptions);
@@ -7,7 +7,7 @@ import { createProdServer, loadServerPlugins } from "@modern-js/prod-server";
7
7
  import { CLOSE_SIGN } from "./consts";
8
8
  process.on("message", function() {
9
9
  var _ref = _async_to_generator(function(chunk) {
10
- var context, routes, renderRoutes, options, appContext, plugins, distDirectory, nodeServer, serverConfig, defaultPort, port, serverOptions, e;
10
+ var context, routes, renderRoutes, options, appContext, plugins, distDirectory, nodeServer, serverConfig, defaultPort, port, serverOptions, _tmp, e;
11
11
  return _ts_generator(this, function(_state) {
12
12
  switch (_state.label) {
13
13
  case 0:
@@ -21,9 +21,9 @@ process.on("message", function() {
21
21
  case 1:
22
22
  _state.trys.push([
23
23
  1,
24
- 4,
24
+ 5,
25
25
  ,
26
- 5
26
+ 6
27
27
  ]);
28
28
  serverConfig = options.server;
29
29
  defaultPort = Number(process.env.PORT) || serverConfig.port;
@@ -34,19 +34,23 @@ process.on("message", function() {
34
34
  ];
35
35
  case 2:
36
36
  port = _state.sent();
37
- serverOptions = {
37
+ _tmp = {
38
38
  pwd: distDirectory,
39
39
  config: options,
40
40
  appContext,
41
- routes,
42
- plugins: loadServerPlugins(plugins, appContext.appDirectory || distDirectory),
43
- staticGenerate: true
41
+ routes
44
42
  };
45
43
  return [
46
44
  4,
47
- createProdServer(serverOptions)
45
+ loadServerPlugins(plugins, appContext.appDirectory || distDirectory)
48
46
  ];
49
47
  case 3:
48
+ serverOptions = (_tmp.plugins = _state.sent(), _tmp.staticGenerate = true, _tmp);
49
+ return [
50
+ 4,
51
+ createProdServer(serverOptions)
52
+ ];
53
+ case 4:
50
54
  nodeServer = _state.sent();
51
55
  nodeServer.listen(port, /* @__PURE__ */ _async_to_generator(function() {
52
56
  var htmlAry;
@@ -80,17 +84,17 @@ process.on("message", function() {
80
84
  }));
81
85
  return [
82
86
  3,
83
- 5
87
+ 6
84
88
  ];
85
- case 4:
89
+ case 5:
86
90
  e = _state.sent();
87
91
  nodeServer === null || nodeServer === void 0 ? void 0 : nodeServer.close();
88
92
  process.stderr.write(_instanceof(e, Error) ? e.stack : e.toString());
89
93
  return [
90
94
  3,
91
- 5
95
+ 6
92
96
  ];
93
- case 5:
97
+ case 6:
94
98
  return [
95
99
  2
96
100
  ];
@@ -19,7 +19,7 @@ process.on("message", async (chunk) => {
19
19
  config: options,
20
20
  appContext,
21
21
  routes,
22
- plugins: loadServerPlugins(plugins, appContext.appDirectory || distDirectory),
22
+ plugins: await loadServerPlugins(plugins, appContext.appDirectory || distDirectory),
23
23
  staticGenerate: true
24
24
  };
25
25
  nodeServer = await createProdServer(serverOptions);
@@ -1,5 +1,5 @@
1
- import { ServerRoute as ModernRoute } from '@modern-js/types';
2
- import { compile } from '../server/prerender';
3
- import { SSGRouteOptions, SsgRoute } from '../types';
1
+ import type { ServerRoute as ModernRoute } from '@modern-js/types';
2
+ import type { compile } from '../server/prerender';
3
+ import type { SSGRouteOptions, SsgRoute } from '../types';
4
4
  export declare function makeRender(ssgRoutes: SsgRoute[], render: ReturnType<typeof compile>, port: number): Promise<string>[];
5
5
  export declare function makeRoute(baseRoute: ModernRoute, route: string | SSGRouteOptions, headers?: Record<string, any>): SsgRoute;
@@ -1,2 +1,2 @@
1
- import { SsgRoute } from '../types';
1
+ import type { SsgRoute } from '../types';
2
2
  export declare function writeHtmlFile(htmlAry: string[], ssgRoutes: SsgRoute[], baseDir: string): void;
@@ -1,4 +1,4 @@
1
- import { ServerRoute as ModernRoute } from '@modern-js/types';
2
- import { SsgRoute } from '../types';
1
+ import type { ServerRoute as ModernRoute } from '@modern-js/types';
2
+ import type { SsgRoute } from '../types';
3
3
  export declare function exist(route: ModernRoute, pageRoutes: ModernRoute[]): number;
4
4
  export declare function replaceRoute(ssgRoutes: SsgRoute[], pageRoutes: ModernRoute[]): ModernRoute[];
@@ -1,6 +1,6 @@
1
- import { ServerRoute as ModernRoute } from '@modern-js/types';
2
- import { ServerUserConfig } from '@modern-js/app-tools';
3
- import { SsgRoute, SSGConfig, EntryPoint, SSGMultiEntryOptions, AgreedRoute } from '../types';
1
+ import type { ServerRoute as ModernRoute } from '@modern-js/types';
2
+ import type { ServerUserConfig } from '@modern-js/app-tools';
3
+ import type { SsgRoute, SSGConfig, EntryPoint, SSGMultiEntryOptions, AgreedRoute } from '../types';
4
4
  export declare function formatOutput(filename: string): string;
5
5
  export declare function formatPath(str: string): string;
6
6
  export declare function isDynamicUrl(url: string): boolean;
@@ -1,4 +1,4 @@
1
1
  import type { AppNormalizedConfig, PluginAPI, AppTools } from '@modern-js/app-tools';
2
- import { ServerRoute as ModernRoute } from '@modern-js/types';
3
- import { SsgRoute } from '../types';
2
+ import type { ServerRoute as ModernRoute } from '@modern-js/types';
3
+ import type { SsgRoute } from '../types';
4
4
  export declare const createServer: (api: PluginAPI<AppTools>, ssgRoutes: SsgRoute[], pageRoutes: ModernRoute[], apiRoutes: ModernRoute[], options: AppNormalizedConfig, appDirectory: string) => Promise<string[]>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { IncomingMessage, ServerResponse } from 'http';
2
+ import type { IncomingMessage, ServerResponse } from 'http';
3
3
  export type Options = {
4
4
  url: string;
5
5
  headers: {
@@ -1,5 +1,5 @@
1
1
  import type { ServerRoute as ModernRoute } from '@modern-js/types';
2
- import { SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions } from '@modern-js/types';
2
+ import type { SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions } from '@modern-js/types';
3
3
  export type { SSGConfig, SSGRouteOptions, SSGMultiEntryOptions, SSGSingleEntryOptions, };
4
4
  export type AgreedRoute = {
5
5
  path?: string;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.58.0",
18
+ "version": "2.58.2",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -59,12 +59,12 @@
59
59
  }
60
60
  },
61
61
  "dependencies": {
62
+ "@swc/helpers": "0.5.3",
62
63
  "node-mocks-http": "^1.11.0",
63
64
  "normalize-path": "3.0.0",
64
65
  "portfinder": "^1.0.28",
65
- "@swc/helpers": "0.5.3",
66
- "@modern-js/utils": "2.58.0",
67
- "@modern-js/prod-server": "2.58.0"
66
+ "@modern-js/prod-server": "2.58.2",
67
+ "@modern-js/utils": "2.58.2"
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
- "@modern-js/types": "2.58.0",
86
- "@modern-js/app-tools": "2.58.0",
87
- "@scripts/build": "2.58.0",
88
- "@scripts/jest-config": "2.58.0"
85
+ "@modern-js/app-tools": "2.58.2",
86
+ "@modern-js/types": "2.58.2",
87
+ "@scripts/build": "2.58.2",
88
+ "@scripts/jest-config": "2.58.2"
89
89
  },
90
90
  "sideEffects": false,
91
91
  "publishConfig": {