@modern-js/prod-server 2.5.1-alpha.0 → 2.5.1-alpha.1

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.
@@ -142,14 +142,16 @@ class Server {
142
142
  }
143
143
  initAppContext() {
144
144
  const { options } = this;
145
- const { pwd: appDirectory, plugins = [], config } = options;
145
+ const { pwd: appDirectory, plugins = [], config, appContext } = options;
146
146
  const serverPlugins = plugins.map((p) => ({
147
147
  server: p
148
148
  }));
149
149
  return {
150
150
  appDirectory,
151
+ apiDirectory: appContext == null ? void 0 : appContext.apiDirectory,
152
+ lambdaDirectory: appContext == null ? void 0 : appContext.lambdaDirectory,
153
+ sharedDirectory: (appContext == null ? void 0 : appContext.sharedDirectory) || import_path.default.resolve(appDirectory, import_utils.SHARED_DIR),
151
154
  distDirectory: import_path.default.join(appDirectory, config.output.path || "dist"),
152
- sharedDirectory: import_path.default.resolve(appDirectory, import_utils.SHARED_DIR),
153
155
  plugins: serverPlugins
154
156
  };
155
157
  }
@@ -471,7 +471,7 @@ var Server = /*#__PURE__*/ function() {
471
471
  key: "initAppContext",
472
472
  value: function initAppContext() {
473
473
  var options = this.options;
474
- var appDirectory = options.pwd, _options_plugins = options.plugins, plugins = _options_plugins === void 0 ? [] : _options_plugins, config = options.config;
474
+ var appDirectory = options.pwd, _options_plugins = options.plugins, plugins = _options_plugins === void 0 ? [] : _options_plugins, config = options.config, appContext = options.appContext;
475
475
  var serverPlugins = plugins.map(function(p) {
476
476
  return {
477
477
  server: p
@@ -479,8 +479,10 @@ var Server = /*#__PURE__*/ function() {
479
479
  });
480
480
  return {
481
481
  appDirectory: appDirectory,
482
+ apiDirectory: appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory,
483
+ lambdaDirectory: appContext === null || appContext === void 0 ? void 0 : appContext.lambdaDirectory,
484
+ sharedDirectory: (appContext === null || appContext === void 0 ? void 0 : appContext.sharedDirectory) || path.resolve(appDirectory, SHARED_DIR),
482
485
  distDirectory: path.join(appDirectory, config.output.path || "dist"),
483
- sharedDirectory: path.resolve(appDirectory, SHARED_DIR),
484
486
  plugins: serverPlugins
485
487
  };
486
488
  }
@@ -130,14 +130,16 @@ class Server {
130
130
  }
131
131
  initAppContext() {
132
132
  const { options } = this;
133
- const { pwd: appDirectory, plugins = [], config } = options;
133
+ const { pwd: appDirectory, plugins = [], config, appContext } = options;
134
134
  const serverPlugins = plugins.map((p) => ({
135
135
  server: p
136
136
  }));
137
137
  return {
138
138
  appDirectory,
139
+ apiDirectory: appContext == null ? void 0 : appContext.apiDirectory,
140
+ lambdaDirectory: appContext == null ? void 0 : appContext.lambdaDirectory,
141
+ sharedDirectory: (appContext == null ? void 0 : appContext.sharedDirectory) || path.resolve(appDirectory, SHARED_DIR),
139
142
  distDirectory: path.join(appDirectory, config.output.path || "dist"),
140
- sharedDirectory: path.resolve(appDirectory, SHARED_DIR),
141
143
  plugins: serverPlugins
142
144
  };
143
145
  }
@@ -3,7 +3,7 @@
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
5
  /// <reference types="node/http" />
6
- /// <reference types=".dts-temp/8rnsll2mo9ytj_poqlbk_/src/type" />
6
+ /// <reference types=".dts-temp/vruupblf2_wmqdzbkln3e/src/type" />
7
7
  import { IncomingMessage, ServerResponse } from 'http';
8
8
  import { URL } from 'url';
9
9
  import qs from 'querystring';
@@ -26,7 +26,14 @@ export type ModernServerOptions = {
26
26
  ssrOnly?: boolean;
27
27
  webOnly?: boolean;
28
28
  runMode?: string;
29
- [propName: string]: any;
29
+ appContext?: {
30
+ appDirectory: string;
31
+ sharedDirectory: string;
32
+ apiDirectory: string;
33
+ lambdaDirectory: string;
34
+ };
35
+ serverConfigFile?: string;
36
+ proxyTarget?: any;
30
37
  };
31
38
  export type RenderResult = {
32
39
  content: string | Buffer;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node/http" />
3
- /// <reference types=".dts-temp/8rnsll2mo9ytj_poqlbk_/src/type" />
3
+ /// <reference types=".dts-temp/vruupblf2_wmqdzbkln3e/src/type" />
4
4
  import { IncomingMessage } from 'http';
5
5
  import type { OutputNormalizedConfig, HtmlNormalizedConfig } from '@modern-js/server-core';
6
6
  export declare const debug: any;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.5.1-alpha.0",
14
+ "version": "2.5.1-alpha.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",
@@ -58,7 +58,7 @@
58
58
  "serve-static": "^1.14.1"
59
59
  },
60
60
  "devDependencies": {
61
- "@modern-js/types": "2.5.0",
61
+ "@modern-js/types": "2.5.1-alpha.0",
62
62
  "@modern-js/server-core": "2.5.1-alpha.0",
63
63
  "@scripts/jest-config": "2.5.0",
64
64
  "@scripts/build": "2.5.0",