@modern-js/server 2.17.1 → 2.18.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 2.18.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/prod-server@2.18.1
8
+ - @modern-js/server-utils@2.18.1
9
+ - @modern-js/types@2.18.1
10
+ - @modern-js/utils@2.18.1
11
+
12
+ ## 2.18.0
13
+
14
+ ### Patch Changes
15
+
16
+ - @modern-js/prod-server@2.18.0
17
+ - @modern-js/server-utils@2.18.0
18
+ - @modern-js/types@2.18.0
19
+ - @modern-js/utils@2.18.0
20
+
3
21
  ## 2.17.1
4
22
 
5
23
  ### Patch Changes
@@ -11,9 +11,8 @@ const _path = /* @__PURE__ */ _interop_require_default(require("path"));
11
11
  const _https = require("https");
12
12
  const _utils = require("@modern-js/utils");
13
13
  const _prodserver = require("@modern-js/prod-server");
14
- const _constants = require("@modern-js/utils/constants");
15
14
  const _lodash = require("@modern-js/utils/lodash");
16
- const _constants1 = require("../constants");
15
+ const _constants = require("../constants");
17
16
  const _mock = require("../dev-tools/mock");
18
17
  const _register = require("../dev-tools/register");
19
18
  const _watcher = /* @__PURE__ */ _interop_require_wildcard(require("../dev-tools/watcher"));
@@ -79,7 +78,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
79
78
  class ModernDevServer extends _prodserver.ModernServer {
80
79
  getDevOptions(options) {
81
80
  const devOptions = typeof options.dev === "boolean" ? {} : options.dev;
82
- const defaultOptions = (0, _constants1.getDefaultDevOptions)();
81
+ const defaultOptions = (0, _constants.getDefaultDevOptions)();
83
82
  return (0, _lodash.merge)(defaultOptions, devOptions);
84
83
  }
85
84
  addMiddlewareHandler(handlers) {
@@ -274,7 +273,7 @@ class ModernDevServer extends _prodserver.ModernServer {
274
273
  delete require.cache[filepath];
275
274
  }
276
275
  });
277
- const loadable = _path.default.join(distDir, _constants.LOADABLE_STATS_FILE);
276
+ const loadable = _path.default.join(distDir, _utils.LOADABLE_STATS_FILE);
278
277
  if (require.cache[loadable]) {
279
278
  delete require.cache[loadable];
280
279
  }
@@ -36,7 +36,7 @@ function handleSuccess() {
36
36
  function handleWarnings(warnings) {
37
37
  var printWarnings = function printWarnings2() {
38
38
  var formatted = formatWebpackMessages({
39
- warnings,
39
+ warnings: warnings,
40
40
  errors: []
41
41
  });
42
42
  if (typeof console !== "undefined" && typeof console.warn === "function") {
@@ -63,7 +63,7 @@ function handleErrors(errors) {
63
63
  isFirstCompilation = false;
64
64
  hasCompileErrors = true;
65
65
  var formatted = formatWebpackMessages({
66
- errors,
66
+ errors: errors,
67
67
  warnings: []
68
68
  });
69
69
  if (typeof console !== "undefined" && typeof console.error === "function") {
@@ -58,7 +58,7 @@ function _create_class(Constructor, protoProps, staticProps) {
58
58
  function _define_property(obj, key, value) {
59
59
  if (key in obj) {
60
60
  Object.defineProperty(obj, key, {
61
- value,
61
+ value: value,
62
62
  enumerable: true,
63
63
  configurable: true,
64
64
  writable: true
@@ -326,7 +326,7 @@ var DevMiddleware = /* @__PURE__ */ function(EventEmitter2) {
326
326
  var middleware = devMiddleware(_object_spread({
327
327
  headers: devOptions.headers,
328
328
  stats: false,
329
- callbacks,
329
+ callbacks: callbacks,
330
330
  hmrClientPath: enableHMR ? getHMRClientPath(devOptions.client) : void 0
331
331
  }, devOptions.devMiddleware));
332
332
  return middleware;
@@ -23,7 +23,7 @@ function _create_class(Constructor, protoProps, staticProps) {
23
23
  function _define_property(obj, key, value) {
24
24
  if (key in obj) {
25
25
  Object.defineProperty(obj, key, {
26
- value,
26
+ value: value,
27
27
  enumerable: true,
28
28
  configurable: true,
29
29
  writable: true
@@ -104,8 +104,8 @@ var SocketServer = /* @__PURE__ */ function() {
104
104
  var _this = this;
105
105
  this.sockets.forEach(function(socket) {
106
106
  _this.send(socket, JSON.stringify({
107
- type,
108
- data
107
+ type: type,
108
+ data: data
109
109
  }));
110
110
  });
111
111
  }
@@ -115,8 +115,8 @@ var SocketServer = /* @__PURE__ */ function() {
115
115
  key: "singleWrite",
116
116
  value: function singleWrite(socket, type, data) {
117
117
  this.send(socket, JSON.stringify({
118
- type,
119
- data
118
+ type: type,
119
+ data: data
120
120
  }));
121
121
  }
122
122
  },
@@ -41,7 +41,7 @@ function _async_to_generator(fn) {
41
41
  function _define_property(obj, key, value) {
42
42
  if (key in obj) {
43
43
  Object.defineProperty(obj, key, {
44
- value,
44
+ value: value,
45
45
  enumerable: true,
46
46
  configurable: true,
47
47
  writable: true
@@ -1,7 +1,7 @@
1
1
  function _define_property(obj, key, value) {
2
2
  if (key in obj) {
3
3
  Object.defineProperty(obj, key, {
4
- value,
4
+ value: value,
5
5
  enumerable: true,
6
6
  configurable: true,
7
7
  writable: true
@@ -58,7 +58,7 @@ var checkDep = function(depName, paths) {
58
58
  var packagePath = "";
59
59
  try {
60
60
  packagePath = require.resolve(depName, {
61
- paths
61
+ paths: paths
62
62
  });
63
63
  } catch (error) {
64
64
  }
@@ -89,7 +89,7 @@ export var enableRegister = function(projectRoot, config) {
89
89
  var alias = config.source.alias;
90
90
  var aliasConfig = getAliasConfig(alias, {
91
91
  appDirectory: projectRoot,
92
- tsconfigPath
92
+ tsconfigPath: tsconfigPath
93
93
  });
94
94
  var _aliasConfig_paths = aliasConfig.paths, paths = _aliasConfig_paths === void 0 ? {} : _aliasConfig_paths, _aliasConfig_absoluteBaseUrl = aliasConfig.absoluteBaseUrl, absoluteBaseUrl = _aliasConfig_absoluteBaseUrl === void 0 ? "./" : _aliasConfig_absoluteBaseUrl;
95
95
  var tsPaths = Object.keys(paths).reduce(function(o, key) {
@@ -128,7 +128,7 @@ export var enableRegister = function(projectRoot, config) {
128
128
  compiler: (_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.compiler
129
129
  }
130
130
  }), {
131
- tsconfigPath,
131
+ tsconfigPath: tsconfigPath,
132
132
  syntax: "es6+",
133
133
  type: "commonjs"
134
134
  });
@@ -34,7 +34,7 @@ function _create_class(Constructor, protoProps, staticProps) {
34
34
  function _define_property(obj, key, value) {
35
35
  if (key in obj) {
36
36
  Object.defineProperty(obj, key, {
37
- value,
37
+ value: value,
38
38
  enumerable: true,
39
39
  configurable: true,
40
40
  writable: true
@@ -107,7 +107,7 @@ export var DependencyTree = /* @__PURE__ */ function() {
107
107
  if (!_this.shouldIgnore(path)) {
108
108
  var module = cache[path];
109
109
  _this.tree.set(module.filename, {
110
- module,
110
+ module: module,
111
111
  parent: /* @__PURE__ */ new Set(),
112
112
  children: /* @__PURE__ */ new Set()
113
113
  });
@@ -34,7 +34,7 @@ function _create_class(Constructor, protoProps, staticProps) {
34
34
  function _define_property(obj, key, value) {
35
35
  if (key in obj) {
36
36
  Object.defineProperty(obj, key, {
37
- value,
37
+ value: value,
38
38
  enumerable: true,
39
39
  configurable: true,
40
40
  writable: true
@@ -23,7 +23,7 @@ function _create_class(Constructor, protoProps, staticProps) {
23
23
  function _define_property(obj, key, value) {
24
24
  if (key in obj) {
25
25
  Object.defineProperty(obj, key, {
26
- value,
26
+ value: value,
27
27
  enumerable: true,
28
28
  configurable: true,
29
29
  writable: true
@@ -73,7 +73,7 @@ function _create_class(Constructor, protoProps, staticProps) {
73
73
  function _define_property(obj, key, value) {
74
74
  if (key in obj) {
75
75
  Object.defineProperty(obj, key, {
76
- value,
76
+ value: value,
77
77
  enumerable: true,
78
78
  configurable: true,
79
79
  writable: true
@@ -335,9 +335,8 @@ var __generator = function(thisArg, body) {
335
335
  import { createServer } from "http";
336
336
  import path from "path";
337
337
  import { createServer as createHttpsServer } from "https";
338
- import { API_DIR, SERVER_BUNDLE_DIRECTORY, SERVER_DIR, SHARED_DIR } from "@modern-js/utils";
338
+ import { API_DIR, SERVER_BUNDLE_DIRECTORY, SERVER_DIR, SHARED_DIR, LOADABLE_STATS_FILE } from "@modern-js/utils";
339
339
  import { createProxyHandler, ModernServer, AGGRED_DIR } from "@modern-js/prod-server";
340
- import { LOADABLE_STATS_FILE } from "@modern-js/utils/constants";
341
340
  import { merge as deepMerge } from "@modern-js/utils/lodash";
342
341
  import { getDefaultDevOptions } from "../constants";
343
342
  import { createMockHandler } from "../dev-tools/mock";
@@ -418,8 +417,8 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
418
417
  }, serverOptions);
419
418
  });
420
419
  return {
421
- befores,
422
- afters
420
+ befores: befores,
421
+ afters: afters
423
422
  };
424
423
  }
425
424
  },
@@ -536,7 +535,7 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
536
535
  next();
537
536
  });
538
537
  _this.mockHandler = createMockHandler({
539
- pwd
538
+ pwd: pwd
540
539
  });
541
540
  _this.addHandler(function(ctx, next) {
542
541
  if (_this.mockHandler) {
@@ -676,7 +675,7 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
676
675
  1
677
676
  ];
678
677
  _this1.mockHandler = createMockHandler({
679
- pwd
678
+ pwd: pwd
680
679
  });
681
680
  return [
682
681
  3,
@@ -692,7 +691,7 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
692
691
  success = _this1.runner.onApiChange([
693
692
  {
694
693
  filename: filepath,
695
- event
694
+ event: event
696
695
  }
697
696
  ]);
698
697
  if (!(success !== true))
@@ -703,7 +702,7 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
703
702
  return [
704
703
  4,
705
704
  _superprop_get_onServerChange().call(_this1, {
706
- filepath
705
+ filepath: filepath
707
706
  })
708
707
  ];
709
708
  case 2:
@@ -856,8 +855,8 @@ export var ModernDevServer = /* @__PURE__ */ function(ModernServer2) {
856
855
  watcher.cleanDepCache(filepath);
857
856
  }
858
857
  _this.onServerChange({
859
- filepath,
860
- event
858
+ filepath: filepath,
859
+ event: event
861
860
  });
862
861
  });
863
862
  this.watcher = watcher;
@@ -14,9 +14,8 @@ function _define_property(obj, key, value) {
14
14
  import { createServer } from "http";
15
15
  import path from "path";
16
16
  import { createServer as createHttpsServer } from "https";
17
- import { API_DIR, SERVER_BUNDLE_DIRECTORY, SERVER_DIR, SHARED_DIR } from "@modern-js/utils";
17
+ import { API_DIR, SERVER_BUNDLE_DIRECTORY, SERVER_DIR, SHARED_DIR, LOADABLE_STATS_FILE } from "@modern-js/utils";
18
18
  import { createProxyHandler, ModernServer, AGGRED_DIR } from "@modern-js/prod-server";
19
- import { LOADABLE_STATS_FILE } from "@modern-js/utils/constants";
20
19
  import { merge as deepMerge } from "@modern-js/utils/lodash";
21
20
  import { getDefaultDevOptions } from "../constants";
22
21
  import { createMockHandler } from "../dev-tools/mock";
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.17.1",
18
+ "version": "2.18.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -45,10 +45,10 @@
45
45
  "minimatch": "^3.0.4",
46
46
  "path-to-regexp": "^6.2.0",
47
47
  "ws": "^8.2.0",
48
- "@modern-js/prod-server": "2.17.1",
49
- "@modern-js/server-utils": "2.17.1",
50
- "@modern-js/types": "2.17.1",
51
- "@modern-js/utils": "2.17.1"
48
+ "@modern-js/prod-server": "2.18.1",
49
+ "@modern-js/server-utils": "2.18.1",
50
+ "@modern-js/types": "2.18.1",
51
+ "@modern-js/utils": "2.18.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/connect-history-api-fallback": "^1.3.5",
@@ -63,9 +63,9 @@
63
63
  "typescript": "^4",
64
64
  "webpack": "^5.76.2",
65
65
  "websocket": "^1",
66
- "@modern-js/server-core": "2.17.1",
67
- "@scripts/build": "2.17.1",
68
- "@scripts/jest-config": "2.17.1"
66
+ "@modern-js/server-core": "2.18.1",
67
+ "@scripts/jest-config": "2.18.1",
68
+ "@scripts/build": "2.18.1"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "devcert": "^1.0.0",