@modern-js/server 2.0.0-beta.1 → 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,122 @@
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
+
72
+ ## 2.0.0-beta.2
73
+
74
+ ### Major Changes
75
+
76
+ - dda38c9c3e: chore: v2
77
+
78
+ ### Patch Changes
79
+
80
+ - 15bf09d9c8: feat: support completely custom server, export render() api for render single page
81
+ feat: 支持完全自定义 Server,导出 render() 方法用来渲染单个页面
82
+ - 61f21d1e77: fix: ignore the entire distPath for pia ssr bundle
83
+ fix: dist 目录的产物不应该被 ts-node 编译
84
+ - ebbeed1: chore: dev server default cross origin
85
+ chore: 开发环境 Server 默认跨域
86
+ - 14b712da84: fix: use consistent alias type and default value across packages
87
+
88
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
89
+
90
+ - Updated dependencies [9b915e0c10]
91
+ - Updated dependencies [c9e800d39a]
92
+ - Updated dependencies [d032d49]
93
+ - Updated dependencies [15bf09d9c8]
94
+ - Updated dependencies [92f0ead]
95
+ - Updated dependencies [edd1cfb1af]
96
+ - Updated dependencies [cc971eabfc]
97
+ - Updated dependencies [5b9049f2e9]
98
+ - Updated dependencies [6bda14ed71]
99
+ - Updated dependencies [a8642da58f]
100
+ - Updated dependencies [92004d1]
101
+ - Updated dependencies [b8bbe036c7]
102
+ - Updated dependencies [40ed587]
103
+ - Updated dependencies [87c1ff8]
104
+ - Updated dependencies [c2bb0f1]
105
+ - Updated dependencies [d5a31df781]
106
+ - Updated dependencies [dda38c9c3e]
107
+ - Updated dependencies [102d32e4ba]
108
+ - Updated dependencies [8b8e1bb571]
109
+ - Updated dependencies [3bbea92b2a]
110
+ - Updated dependencies [73cd29dd9f]
111
+ - Updated dependencies [18aaf42]
112
+ - Updated dependencies [abf3421a75]
113
+ - Updated dependencies [543be9558e]
114
+ - Updated dependencies [14b712da84]
115
+ - @modern-js/server-utils@2.0.0-beta.2
116
+ - @modern-js/prod-server@2.0.0-beta.2
117
+ - @modern-js/utils@2.0.0-beta.2
118
+ - @modern-js/types@2.0.0-beta.2
119
+
3
120
  ## 2.0.0-beta.1
4
121
 
5
122
  ### Major Changes
@@ -24,9 +24,9 @@ export const enableRegister = (projectRoot, config
24
24
  const existTsNode = checkDep('ts-node', [projectRoot]);
25
25
  const existTsConfigPaths = checkDep('tsconfig-paths', [projectRoot]);
26
26
  if (isTsProject && existTsNode && existTsConfigPaths) {
27
- var _config$output;
27
+ var _config$output$distPa;
28
28
  debug('use ts-node');
29
- const distPath = (config === null || config === void 0 ? void 0 : (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.path) || 'dist';
29
+ const distPath = ((_config$output$distPa = config.output.distPath) === null || _config$output$distPa === void 0 ? void 0 : _config$output$distPa.root) || 'dist';
30
30
  const tsNode = require('ts-node');
31
31
  const tsConfigPaths = require('tsconfig-paths');
32
32
  const {
@@ -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,14 +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
+ const defaultWatched = [`${mock}/**/*`, `${SERVER_DIR}/**/*`, `${API_DIR}/**`, `${SHARED_DIR}/**/*`, `${distDir}/${LOADER_ROUTES_DIR}/**`];
298
299
  const watchOptions = mergeWatchOptions((_this$conf$server = this.conf.server) === null || _this$conf$server === void 0 ? void 0 : _this$conf$server.watchOptions);
299
- 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
+ });
300
304
  const watcher = new Watcher();
301
305
  watcher.createDepTree();
302
306
 
@@ -31,9 +31,9 @@ const enableRegister = (projectRoot, config
31
31
  const existTsNode = checkDep('ts-node', [projectRoot]);
32
32
  const existTsConfigPaths = checkDep('tsconfig-paths', [projectRoot]);
33
33
  if (isTsProject && existTsNode && existTsConfigPaths) {
34
- var _config$output;
34
+ var _config$output$distPa;
35
35
  debug('use ts-node');
36
- const distPath = (config === null || config === void 0 ? void 0 : (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.path) || 'dist';
36
+ const distPath = ((_config$output$distPa = config.output.distPath) === null || _config$output$distPa === void 0 ? void 0 : _config$output$distPa.root) || 'dist';
37
37
  const tsNode = require('ts-node');
38
38
  const tsConfigPaths = require('tsconfig-paths');
39
39
  const {
@@ -298,14 +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
+ const defaultWatched = [`${mock}/**/*`, `${_utils.SERVER_DIR}/**/*`, `${_utils.API_DIR}/**`, `${_utils.SHARED_DIR}/**/*`, `${distDir}/${_utils.LOADER_ROUTES_DIR}/**`];
307
308
  const watchOptions = (0, _watcher.mergeWatchOptions)((_this$conf$server = this.conf.server) === null || _this$conf$server === void 0 ? void 0 : _this$conf$server.watchOptions);
308
- 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
+ });
309
313
  const watcher = new _watcher.default();
310
314
  watcher.createDepTree();
311
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.1",
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.1",
39
- "@modern-js/server-utils": "2.0.0-beta.1",
40
- "@modern-js/types": "2.0.0-beta.1",
41
- "@modern-js/utils": "2.0.0-beta.1"
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,18 +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/core": "2.0.0-beta.1",
57
- "@modern-js/server-core": "2.0.0-beta.1",
58
- "@scripts/build": "2.0.0-beta.1",
59
- "@scripts/jest-config": "2.0.0-beta.1"
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"
60
59
  },
61
60
  "peerDependencies": {
62
61
  "ts-node": "^10.1.0",
63
- "tsconfig-paths": "3.14.1"
62
+ "tsconfig-paths": ">= 3.0.0 || >= 4.0.0"
64
63
  },
65
64
  "sideEffects": false,
66
65
  "modernConfig": {
@@ -73,9 +72,9 @@
73
72
  "access": "public"
74
73
  },
75
74
  "scripts": {
76
- "new": "modern new",
77
- "build": "modern build",
78
- "dev": "modern build --watch",
75
+ "new": "modern-lib new",
76
+ "build": "modern-lib build",
77
+ "dev": "modern-lib build --watch",
79
78
  "test": "jest"
80
79
  }
81
80
  }