@modern-js/server 0.0.0-next-20230226140607 → 0.0.0-next-20230227084544

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,6 +1,11 @@
1
1
  # @modern-js/server
2
2
 
3
- ## 0.0.0-next-20230226140607
3
+ ## 0.0.0-next-20230227084544
4
+
5
+ ### Minor Changes
6
+
7
+ - 84bfb439b: feat: support custom apiDir, lambdaDir and style of writing for bff
8
+ feat: 支持定制 api 目录,lambda 目录,bff 的写法
4
9
 
5
10
  ### Patch Changes
6
11
 
@@ -15,10 +20,11 @@
15
20
  - Updated dependencies [dcad88702]
16
21
  - Updated dependencies [7fff9020e]
17
22
  - Updated dependencies [1eea234fd]
18
- - @modern-js/types@0.0.0-next-20230226140607
19
- - @modern-js/utils@0.0.0-next-20230226140607
20
- - @modern-js/prod-server@0.0.0-next-20230226140607
21
- - @modern-js/server-utils@0.0.0-next-20230226140607
23
+ - Updated dependencies [84bfb439b]
24
+ - @modern-js/types@0.0.0-next-20230227084544
25
+ - @modern-js/utils@0.0.0-next-20230227084544
26
+ - @modern-js/prod-server@0.0.0-next-20230227084544
27
+ - @modern-js/server-utils@0.0.0-next-20230227084544
22
28
 
23
29
  ## 2.6.0
24
30
 
@@ -45,6 +45,7 @@ class ModernDevServer extends import_prod_server.ModernServer {
45
45
  constructor(options) {
46
46
  super(options);
47
47
  this.mockHandler = null;
48
+ this.appContext = options.appContext;
48
49
  this.workDir = this.pwd;
49
50
  this.dev = this.getDevOptions(options);
50
51
  this.devMiddleware = new import_dev_middleware.default({
@@ -239,13 +240,15 @@ class ModernDevServer extends import_prod_server.ModernServer {
239
240
  }
240
241
  startWatcher() {
241
242
  var _a;
242
- const { pwd, distDir } = this;
243
+ const { pwd, distDir, appContext } = this;
243
244
  const { mock } = import_prod_server.AGGRED_DIR;
245
+ const apiDir = (appContext == null ? void 0 : appContext.apiDirectory) || import_utils.API_DIR;
246
+ const sharedDir = (appContext == null ? void 0 : appContext.sharedDirectory) || import_utils.SHARED_DIR;
244
247
  const defaultWatched = [
245
248
  `${mock}/**/*`,
246
249
  `${import_utils.SERVER_DIR}/**/*`,
247
- `${import_utils.API_DIR}/**`,
248
- `${import_utils.SHARED_DIR}/**/*`,
250
+ `${apiDir}/**`,
251
+ `${sharedDir}/**/*`,
249
252
  `${distDir}/${import_utils.SERVER_BUNDLE_DIRECTORY}/*-server-loaders.js`
250
253
  ];
251
254
  const watchOptions = (0, import_watcher.mergeWatchOptions)((_a = this.conf.server) == null ? void 0 : _a.watchOptions);
@@ -361,8 +361,10 @@ var ModernDevServer = /*#__PURE__*/ function(ModernServer) {
361
361
  _this = _super.call(this, options);
362
362
  _defineProperty(_assertThisInitialized(_this), "mockHandler", null);
363
363
  _defineProperty(_assertThisInitialized(_this), "dev", void 0);
364
+ _defineProperty(_assertThisInitialized(_this), "appContext", void 0);
364
365
  _defineProperty(_assertThisInitialized(_this), "devMiddleware", void 0);
365
366
  _defineProperty(_assertThisInitialized(_this), "watcher", void 0);
367
+ _this.appContext = options.appContext;
366
368
  _this.workDir = _this.pwd;
367
369
  _this.dev = _this.getDevOptions(options);
368
370
  _this.devMiddleware = new DevMiddleware({
@@ -768,13 +770,15 @@ var ModernDevServer = /*#__PURE__*/ function(ModernServer) {
768
770
  value: function startWatcher() {
769
771
  var _this = this;
770
772
  var _this_conf_server;
771
- var _this1 = this, pwd = _this1.pwd, distDir = _this1.distDir;
773
+ var _this1 = this, pwd = _this1.pwd, distDir = _this1.distDir, appContext = _this1.appContext;
772
774
  var mock = AGGRED_DIR.mock;
775
+ var apiDir = (appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory) || API_DIR;
776
+ var sharedDir = (appContext === null || appContext === void 0 ? void 0 : appContext.sharedDirectory) || SHARED_DIR;
773
777
  var defaultWatched = [
774
778
  "".concat(mock, "/**/*"),
775
779
  "".concat(SERVER_DIR, "/**/*"),
776
- "".concat(API_DIR, "/**"),
777
- "".concat(SHARED_DIR, "/**/*"),
780
+ "".concat(apiDir, "/**"),
781
+ "".concat(sharedDir, "/**/*"),
778
782
  "".concat(distDir, "/").concat(SERVER_BUNDLE_DIRECTORY, "/*-server-loaders.js")
779
783
  ];
780
784
  var watchOptions = mergeWatchOptions((_this_conf_server = this.conf.server) === null || _this_conf_server === void 0 ? void 0 : _this_conf_server.watchOptions);
@@ -22,6 +22,7 @@ class ModernDevServer extends ModernServer {
22
22
  constructor(options) {
23
23
  super(options);
24
24
  this.mockHandler = null;
25
+ this.appContext = options.appContext;
25
26
  this.workDir = this.pwd;
26
27
  this.dev = this.getDevOptions(options);
27
28
  this.devMiddleware = new DevMiddleware({
@@ -216,13 +217,15 @@ class ModernDevServer extends ModernServer {
216
217
  }
217
218
  startWatcher() {
218
219
  var _a;
219
- const { pwd, distDir } = this;
220
+ const { pwd, distDir, appContext } = this;
220
221
  const { mock } = AGGRED_DIR;
222
+ const apiDir = (appContext == null ? void 0 : appContext.apiDirectory) || API_DIR;
223
+ const sharedDir = (appContext == null ? void 0 : appContext.sharedDirectory) || SHARED_DIR;
221
224
  const defaultWatched = [
222
225
  `${mock}/**/*`,
223
226
  `${SERVER_DIR}/**/*`,
224
- `${API_DIR}/**`,
225
- `${SHARED_DIR}/**/*`,
227
+ `${apiDir}/**`,
228
+ `${sharedDir}/**/*`,
226
229
  `${distDir}/${SERVER_BUNDLE_DIRECTORY}/*-server-loaders.js`
227
230
  ];
228
231
  const watchOptions = mergeWatchOptions((_a = this.conf.server) == null ? void 0 : _a.watchOptions);
@@ -7,6 +7,7 @@ import type { ModernDevServerOptions } from '../types';
7
7
  export declare class ModernDevServer extends ModernServer {
8
8
  private mockHandler;
9
9
  private readonly dev;
10
+ private readonly appContext;
10
11
  private readonly devMiddleware;
11
12
  private watcher?;
12
13
  constructor(options: ModernDevServerOptions);
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "0.0.0-next-20230226140607",
14
+ "version": "0.0.0-next-20230227084544",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",
@@ -33,10 +33,10 @@
33
33
  "minimatch": "^3.0.4",
34
34
  "path-to-regexp": "^6.2.0",
35
35
  "ws": "^8.2.0",
36
- "@modern-js/prod-server": "0.0.0-next-20230226140607",
37
- "@modern-js/server-utils": "0.0.0-next-20230226140607",
38
- "@modern-js/types": "0.0.0-next-20230226140607",
39
- "@modern-js/utils": "0.0.0-next-20230226140607"
36
+ "@modern-js/prod-server": "0.0.0-next-20230227084544",
37
+ "@modern-js/server-utils": "0.0.0-next-20230227084544",
38
+ "@modern-js/types": "0.0.0-next-20230227084544",
39
+ "@modern-js/utils": "0.0.0-next-20230227084544"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/connect-history-api-fallback": "^1.3.5",
@@ -51,9 +51,9 @@
51
51
  "typescript": "^4",
52
52
  "webpack": "^5.75.0",
53
53
  "websocket": "^1",
54
- "@modern-js/server-core": "0.0.0-next-20230226140607",
55
- "@scripts/build": "0.0.0-next-20230226140607",
56
- "@scripts/jest-config": "0.0.0-next-20230226140607"
54
+ "@scripts/jest-config": "0.0.0-next-20230227084544",
55
+ "@modern-js/server-core": "0.0.0-next-20230227084544",
56
+ "@scripts/build": "0.0.0-next-20230227084544"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "devcert": "^1.0.0",