@modern-js/server 2.0.0-beta.2 → 2.0.0-beta.3

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,74 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 2.0.0-beta.3
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9c3e: chore: v2
8
+
9
+ ### Minor Changes
10
+
11
+ - b710adb: feat: extract the data loader
12
+ feat: 提取 data loader
13
+
14
+ ### Patch Changes
15
+
16
+ - d4e8e6f: fix: modernjs dev server can't start normaly
17
+ fix: modernjs dev 服务端不能正常启动
18
+ - 15bf09d9c8: feat: support completely custom server, export render() api for render single page
19
+ feat: 支持完全自定义 Server,导出 render() 方法用来渲染单个页面
20
+ - 61f21d1e77: fix: ignore the entire distPath for pia ssr bundle
21
+ fix: dist 目录的产物不应该被 ts-node 编译
22
+ - cce8ece: fix: handle some `TODO` & `FIXME`, change some tests
23
+ fix: 处理一些 `TODO` 和 `FIXME`, 修改了一些 tests
24
+ - ea7cf06: chore: bump webpack/babel-loader/postcss-loader/tsconfig-paths
25
+
26
+ chore: 升级 webpack/babel-loader/postcss-loader/tsconfig-paths 版本
27
+
28
+ - ebbeed1ece: chore: dev server default cross origin
29
+ chore: 开发环境 Server 默认跨域
30
+ - 14b712da84: fix: use consistent alias type and default value across packages
31
+
32
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
33
+
34
+ - Updated dependencies [9b915e0c10]
35
+ - Updated dependencies [c9e800d39a]
36
+ - Updated dependencies [d4e8e6f]
37
+ - Updated dependencies [d032d49e09]
38
+ - Updated dependencies [6aca875]
39
+ - Updated dependencies [15bf09d9c8]
40
+ - Updated dependencies [2e60319]
41
+ - Updated dependencies [92f0eade39]
42
+ - Updated dependencies [edd1cfb1af]
43
+ - Updated dependencies [cc971eabfc]
44
+ - Updated dependencies [5b9049f2e9]
45
+ - Updated dependencies [6bda14ed71]
46
+ - Updated dependencies [a8642da58f]
47
+ - Updated dependencies [92004d1906]
48
+ - Updated dependencies [b8bbe036c7]
49
+ - Updated dependencies [40ed5874c6]
50
+ - Updated dependencies [87c1ff86b9]
51
+ - Updated dependencies [c2bb0f1]
52
+ - Updated dependencies [d5a31df781]
53
+ - Updated dependencies [dda38c9c3e]
54
+ - Updated dependencies [102d32e4ba]
55
+ - Updated dependencies [8b8e1bb571]
56
+ - Updated dependencies [3bbea92b2a]
57
+ - Updated dependencies [73cd29dd9f]
58
+ - Updated dependencies [b710adb]
59
+ - Updated dependencies [cce8ece]
60
+ - Updated dependencies [18aaf42249]
61
+ - Updated dependencies [ea7cf06]
62
+ - Updated dependencies [bbe4c4a]
63
+ - Updated dependencies [e4558a0]
64
+ - Updated dependencies [abf3421a75]
65
+ - Updated dependencies [543be9558e]
66
+ - Updated dependencies [14b712da84]
67
+ - @modern-js/server-utils@2.0.0-beta.3
68
+ - @modern-js/prod-server@2.0.0-beta.3
69
+ - @modern-js/utils@2.0.0-beta.3
70
+ - @modern-js/types@2.0.0-beta.3
71
+
3
72
  ## 2.0.0-beta.2
4
73
 
5
74
  ### Major Changes
@@ -69,7 +69,6 @@ export const enableRegister = (projectRoot, config
69
69
  const babelConfig = resolveBabelConfig(projectRoot, _objectSpread(_objectSpread({}, config.source), {}, {
70
70
  babelConfig: (_config$tools = config.tools) === null || _config$tools === void 0 ? void 0 : _config$tools.babel,
71
71
  server: {
72
- // FIXME: the compiler config from ??
73
72
  compiler: (_config$server = config.server) === null || _config$server === void 0 ? void 0 : _config$server.compiler
74
73
  }
75
74
  }), {
@@ -4,7 +4,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4
4
  import { createServer } from 'http';
5
5
  import path from 'path';
6
6
  import { createServer as createHttpsServer } from 'https';
7
- import { API_DIR, SERVER_DIR, SHARED_DIR } from '@modern-js/utils';
7
+ import { API_DIR, LOADER_ROUTES_DIR, SERVER_DIR, SHARED_DIR } from '@modern-js/utils';
8
8
  import { createProxyHandler, ModernServer, AGGRED_DIR } from '@modern-js/prod-server';
9
9
  import { LOADABLE_STATS_FILE } from '@modern-js/utils/constants';
10
10
  import { getDefaultDevOptions } from "../constants";
@@ -289,16 +289,18 @@ export class ModernDevServer extends ModernServer {
289
289
  startWatcher() {
290
290
  var _this$conf$server;
291
291
  const {
292
- pwd
292
+ pwd,
293
+ distDir
293
294
  } = this;
294
295
  const {
295
296
  mock
296
297
  } = AGGRED_DIR;
297
- const defaultWatched = [`${mock}/**/*`, `${SERVER_DIR}/**/*`, `${API_DIR}/**`, `${SHARED_DIR}/**/*`];
298
-
299
- // FIXME: the server config.watchOptions;
298
+ const defaultWatched = [`${mock}/**/*`, `${SERVER_DIR}/**/*`, `${API_DIR}/**`, `${SHARED_DIR}/**/*`, `${distDir}/${LOADER_ROUTES_DIR}/**`];
300
299
  const watchOptions = mergeWatchOptions((_this$conf$server = this.conf.server) === null || _this$conf$server === void 0 ? void 0 : _this$conf$server.watchOptions);
301
- const defaultWatchedPaths = defaultWatched.map(p => path.normalize(path.join(pwd, p)));
300
+ const defaultWatchedPaths = defaultWatched.map(p => {
301
+ const finalPath = path.isAbsolute(p) ? p : path.join(pwd, p);
302
+ return path.normalize(finalPath);
303
+ });
302
304
  const watcher = new Watcher();
303
305
  watcher.createDepTree();
304
306
 
@@ -76,7 +76,6 @@ const enableRegister = (projectRoot, config
76
76
  const babelConfig = (0, _serverUtils.resolveBabelConfig)(projectRoot, _objectSpread(_objectSpread({}, config.source), {}, {
77
77
  babelConfig: (_config$tools = config.tools) === null || _config$tools === void 0 ? void 0 : _config$tools.babel,
78
78
  server: {
79
- // FIXME: the compiler config from ??
80
79
  compiler: (_config$server = config.server) === null || _config$server === void 0 ? void 0 : _config$server.compiler
81
80
  }
82
81
  }), {
@@ -298,16 +298,18 @@ class ModernDevServer extends _prodServer.ModernServer {
298
298
  startWatcher() {
299
299
  var _this$conf$server;
300
300
  const {
301
- pwd
301
+ pwd,
302
+ distDir
302
303
  } = this;
303
304
  const {
304
305
  mock
305
306
  } = _prodServer.AGGRED_DIR;
306
- const defaultWatched = [`${mock}/**/*`, `${_utils.SERVER_DIR}/**/*`, `${_utils.API_DIR}/**`, `${_utils.SHARED_DIR}/**/*`];
307
-
308
- // FIXME: the server config.watchOptions;
307
+ const defaultWatched = [`${mock}/**/*`, `${_utils.SERVER_DIR}/**/*`, `${_utils.API_DIR}/**`, `${_utils.SHARED_DIR}/**/*`, `${distDir}/${_utils.LOADER_ROUTES_DIR}/**`];
309
308
  const watchOptions = (0, _watcher.mergeWatchOptions)((_this$conf$server = this.conf.server) === null || _this$conf$server === void 0 ? void 0 : _this$conf$server.watchOptions);
310
- const defaultWatchedPaths = defaultWatched.map(p => _path.default.normalize(_path.default.join(pwd, p)));
309
+ const defaultWatchedPaths = defaultWatched.map(p => {
310
+ const finalPath = _path.default.isAbsolute(p) ? p : _path.default.join(pwd, p);
311
+ return _path.default.normalize(finalPath);
312
+ });
311
313
  const watcher = new _watcher.default();
312
314
  watcher.createDepTree();
313
315
 
@@ -5,23 +5,7 @@ export declare const defaultWatchOptions: {
5
5
  ignored: RegExp;
6
6
  };
7
7
  export declare const getWatchedFiles: (watcher: FSWatcher) => string[];
8
- export declare const mergeWatchOptions: (options?: WatchOptions) => {
9
- persistent?: boolean | undefined;
10
- ignored: import("@modern-js/utils/compiled/chokidar/anymatch").Matcher;
11
- ignoreInitial: boolean;
12
- followSymlinks?: boolean | undefined;
13
- cwd?: string | undefined;
14
- disableGlobbing?: boolean | undefined;
15
- usePolling?: boolean | undefined;
16
- useFsEvents?: boolean | undefined;
17
- alwaysStat?: boolean | undefined;
18
- depth?: number | undefined;
19
- interval?: number | undefined;
20
- binaryInterval?: number | undefined;
21
- ignorePermissionErrors?: boolean | undefined;
22
- atomic?: number | boolean | undefined;
23
- awaitWriteFinish?: boolean | import("@modern-js/utils/compiled/chokidar").AwaitWriteFinishOptions | undefined;
24
- };
8
+ export declare const mergeWatchOptions: (options?: any) => any;
25
9
  export default class Watcher {
26
10
  private dependencyTree;
27
11
  private watcher;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.0.0-beta.2",
14
+ "version": "2.0.0-beta.3",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -35,10 +35,10 @@
35
35
  "minimatch": "^3.0.4",
36
36
  "path-to-regexp": "^6.2.0",
37
37
  "ws": "^8.2.0",
38
- "@modern-js/prod-server": "2.0.0-beta.2",
39
- "@modern-js/server-utils": "2.0.0-beta.2",
40
- "@modern-js/types": "2.0.0-beta.2",
41
- "@modern-js/utils": "2.0.0-beta.2"
38
+ "@modern-js/prod-server": "2.0.0-beta.3",
39
+ "@modern-js/server-utils": "2.0.0-beta.3",
40
+ "@modern-js/types": "2.0.0-beta.3",
41
+ "@modern-js/utils": "2.0.0-beta.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/connect-history-api-fallback": "^1.3.5",
@@ -49,17 +49,17 @@
49
49
  "jest": "^27",
50
50
  "node-mocks-http": "^1.11.0",
51
51
  "ts-node": "^10.1.0",
52
- "tsconfig-paths": "3.14.1",
52
+ "tsconfig-paths": "4.1.1",
53
53
  "typescript": "^4",
54
- "webpack": "^5.74.0",
54
+ "webpack": "^5.75.0",
55
55
  "websocket": "^1",
56
- "@modern-js/server-core": "2.0.0-beta.2",
57
- "@scripts/build": "2.0.0-beta.2",
58
- "@scripts/jest-config": "2.0.0-beta.2"
56
+ "@modern-js/server-core": "2.0.0-beta.3",
57
+ "@scripts/build": "2.0.0-beta.3",
58
+ "@scripts/jest-config": "2.0.0-beta.3"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "ts-node": "^10.1.0",
62
- "tsconfig-paths": "3.14.1"
62
+ "tsconfig-paths": ">= 3.0.0 || >= 4.0.0"
63
63
  },
64
64
  "sideEffects": false,
65
65
  "modernConfig": {