@modern-js/server 1.3.1-beta.0 → 1.3.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,19 @@
1
1
  # @modern-js/server
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e2d3a575: fix extending core config interface
8
+ - 823809c6: fix: hot reload not working on windows
9
+ - e2d3a575: fix extending core config interface
10
+ - Updated dependencies [823809c6]
11
+ - Updated dependencies [4584cc04]
12
+ - Updated dependencies [7c19fd94]
13
+ - @modern-js/bff-utils@1.2.1
14
+ - @modern-js/utils@1.2.1
15
+ - @modern-js/core@1.3.1
16
+
3
17
  ## 1.3.0
4
18
 
5
19
  ### Minor Changes
@@ -21,9 +21,7 @@ export default class Watcher {
21
21
 
22
22
  listen(files, options, callback) {
23
23
  const watched = files.filter(Boolean);
24
- const filenames = watched.map(filename => filename.replace(/\\/g, '/')); // eslint-disable-next-line no-console
25
-
26
- console.log('watched files:', filenames);
24
+ const filenames = watched.map(filename => filename.replace(/\\/g, '/'));
27
25
  const cache = new StatsCache();
28
26
  const watcher = chokidar.watch(filenames, options);
29
27
  watcher.on('ready', () => {
@@ -32,9 +32,7 @@ class Watcher {
32
32
 
33
33
  listen(files, options, callback) {
34
34
  const watched = files.filter(Boolean);
35
- const filenames = watched.map(filename => filename.replace(/\\/g, '/')); // eslint-disable-next-line no-console
36
-
37
- console.log('watched files:', filenames);
35
+ const filenames = watched.map(filename => filename.replace(/\\/g, '/'));
38
36
  const cache = new _statsCache.StatsCache();
39
37
 
40
38
  const watcher = _chokidar.default.watch(filenames, options);
@@ -12,7 +12,7 @@ declare module 'http' {
12
12
  }
13
13
  declare module '@modern-js/core' {
14
14
  interface UserConfig {
15
- bff: {
15
+ bff?: {
16
16
  proxy: Record<string, any>;
17
17
  };
18
18
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.3.1-beta.0",
14
+ "version": "1.3.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -34,12 +34,12 @@
34
34
  "@babel/preset-typescript": "^7.15.0",
35
35
  "@babel/register": "^7.15.3",
36
36
  "@babel/runtime": "^7",
37
- "@modern-js/core": "^1.3.0",
37
+ "@modern-js/core": "^1.3.1",
38
38
  "@modern-js/hmr-client": "^1.2.0",
39
39
  "@modern-js/server-plugin": "^1.2.0",
40
40
  "@modern-js/server-utils": "^1.2.0",
41
- "@modern-js/bff-utils": "^1.2.0",
42
- "@modern-js/utils": "^1.2.0",
41
+ "@modern-js/bff-utils": "^1.2.1",
42
+ "@modern-js/utils": "^1.2.1",
43
43
  "axios": "^0.21.4",
44
44
  "babel-plugin-module-resolver": "^4.1.0",
45
45
  "chokidar": "^3.5.2",
@@ -25,8 +25,6 @@ export default class Watcher {
25
25
  ) {
26
26
  const watched = files.filter(Boolean);
27
27
  const filenames = watched.map(filename => filename.replace(/\\/g, '/'));
28
- // eslint-disable-next-line no-console
29
- console.log('watched files:', filenames);
30
28
 
31
29
  const cache = new StatsCache();
32
30
  const watcher = chokidar.watch(filenames, options);
package/src/type.ts CHANGED
@@ -14,7 +14,7 @@ declare module 'http' {
14
14
 
15
15
  declare module '@modern-js/core' {
16
16
  interface UserConfig {
17
- bff: {
17
+ bff?: {
18
18
  proxy: Record<string, any>;
19
19
  };
20
20
  }
package/tests/dev.test.ts CHANGED
@@ -1,11 +1,16 @@
1
1
  import http from 'http';
2
2
  import SocketServer from '../src/dev-tools/socket-server';
3
3
 
4
+ function getRandomPort() {
5
+ return Math.floor(Math.random() * (8000 - 1024)) + 1024;
6
+ }
7
+
4
8
  describe('test dev tools', () => {
5
9
  test('should socket server work correctly', () => {
10
+ const port = getRandomPort();
6
11
  const socketServer: any = new SocketServer({
7
12
  client: {
8
- port: '8080',
13
+ port: port.toString(),
9
14
  overlay: false,
10
15
  logging: 'error',
11
16
  path: '/',
@@ -22,7 +27,7 @@ describe('test dev tools', () => {
22
27
  .createServer((req, res) => {
23
28
  res.end();
24
29
  })
25
- .listen(8080);
30
+ .listen(port);
26
31
 
27
32
  socketServer.prepare(app);
28
33
  expect(socketServer.app).toBe(app);
@@ -5,7 +5,6 @@
5
5
  "jsx": "preserve",
6
6
  "baseUrl": "./",
7
7
  "paths": {
8
- ,
9
8
  "@shared/*": ["./shared/*"]
10
9
  }
11
10
  },
@@ -20,7 +20,6 @@ describe('watcher', () => {
20
20
  fs.removeSync(serverDir);
21
21
  }
22
22
  const writeFiles = () => {
23
- fs.mkdirSync(serverDir);
24
23
  fs.writeFileSync(
25
24
  path.normalize(path.join(serverDir, 'index.js')),
26
25
  'test',
@@ -32,6 +31,8 @@ describe('watcher', () => {
32
31
  fs.removeSync(serverDir);
33
32
  };
34
33
 
34
+ fs.mkdirSync(serverDir);
35
+
35
36
  watcher.listen(
36
37
  [`${serverDir}/**/*`],
37
38
  {
@@ -61,9 +62,6 @@ describe('watcher', () => {
61
62
  }
62
63
 
63
64
  const writeFiles = () => {
64
- fs.mkdirSync(path.normalize(path.join(apiDir, 'typings')), {
65
- recursive: true,
66
- });
67
65
  fs.writeFileSync(
68
66
  path.normalize(path.join(apiDir, 'typings/index.js')),
69
67
  'test',
@@ -75,6 +73,10 @@ describe('watcher', () => {
75
73
  fs.removeSync(apiDir);
76
74
  };
77
75
 
76
+ fs.mkdirSync(path.normalize(path.join(apiDir, 'typings')), {
77
+ recursive: true,
78
+ });
79
+
78
80
  watcher.listen(
79
81
  [`${apiDir}/**/*`],
80
82
  {