@modern-js/server 1.4.13 → 1.4.14

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
+ ## 1.4.14
4
+
5
+ ### Patch Changes
6
+
7
+ - d32f35134: chore: add modern/jest/eslint/ts config files to .npmignore
8
+ - Updated dependencies [d32f35134]
9
+ - Updated dependencies [86fe5a657]
10
+ - Updated dependencies [aeda91deb]
11
+ - Updated dependencies [6ae4a34ae]
12
+ - Updated dependencies [b80229c79]
13
+ - Updated dependencies [1a30be07b]
14
+ - Updated dependencies [948cc4436]
15
+ - @modern-js/bff-utils@1.2.6
16
+ - @modern-js/hmr-client@1.2.7
17
+ - @modern-js/prod-server@1.1.5
18
+ - @modern-js/server-utils@1.2.6
19
+ - @modern-js/utils@1.7.3
20
+
3
21
  ## 1.4.13
4
22
 
5
23
  ### Patch Changes
@@ -11,7 +11,8 @@ const {
11
11
  } = Webpack;
12
12
  export default class DevServerPlugin {
13
13
  constructor(options) {
14
- this.options = void 0;
14
+ _defineProperty(this, "options", void 0);
15
+
15
16
  this.options = options;
16
17
  }
17
18
 
@@ -1,13 +1,21 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import ws from 'ws';
2
4
  import { logger } from '@modern-js/utils';
3
5
  export default class SocketServer {
4
6
  constructor(options) {
5
- this.wsServer = void 0;
6
- this.sockets = [];
7
- this.options = void 0;
8
- this.app = void 0;
9
- this.stats = void 0;
10
- this.timer = null;
7
+ _defineProperty(this, "wsServer", void 0);
8
+
9
+ _defineProperty(this, "sockets", []);
10
+
11
+ _defineProperty(this, "options", void 0);
12
+
13
+ _defineProperty(this, "app", void 0);
14
+
15
+ _defineProperty(this, "stats", void 0);
16
+
17
+ _defineProperty(this, "timer", null);
18
+
11
19
  this.options = options;
12
20
  } // create socket, install socket handler, bind socket event
13
21
 
@@ -1,3 +1,5 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import minimatch from 'minimatch';
2
4
  export const defaultIgnores = ['**/bower_components/**', '**/coverage/**', '**/node_modules/**', '**/.*/**', '**/*.d.ts', '**/*.log'];
3
5
 
@@ -8,8 +10,10 @@ export const defaultIgnores = ['**/bower_components/**', '**/coverage/**', '**/n
8
10
  */
9
11
  export class DependencyTree {
10
12
  constructor() {
11
- this.tree = void 0;
12
- this.ignore = void 0;
13
+ _defineProperty(this, "tree", void 0);
14
+
15
+ _defineProperty(this, "ignore", void 0);
16
+
13
17
  this.tree = new Map();
14
18
  this.ignore = [...defaultIgnores];
15
19
  }
@@ -1,3 +1,5 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import path from 'path';
2
4
  import { fs, chokidar } from '@modern-js/utils';
3
5
  import { DependencyTree } from "./dependency-tree";
@@ -14,8 +16,9 @@ export const getWatchedFiles = watcher => {
14
16
  };
15
17
  export default class Watcher {
16
18
  constructor() {
17
- this.dependencyTree = null;
18
- this.watcher = void 0;
19
+ _defineProperty(this, "dependencyTree", null);
20
+
21
+ _defineProperty(this, "watcher", void 0);
19
22
  }
20
23
 
21
24
  listen(files, options, callback) {
@@ -1,9 +1,12 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import fs from 'fs';
2
4
  import crypto from 'crypto';
3
5
  export class StatsCache {
4
6
  constructor() {
5
- this.cachedHash = {};
6
- this.cachedSize = {};
7
+ _defineProperty(this, "cachedHash", {});
8
+
9
+ _defineProperty(this, "cachedSize", {});
7
10
  }
8
11
 
9
12
  add(files) {
@@ -21,12 +21,18 @@ export class ModernDevServer extends ModernServer {
21
21
  constructor(options) {
22
22
  super(options); // dev server should work in pwd
23
23
 
24
- this.mockHandler = null;
25
- this.dev = void 0;
26
- this.compiler = void 0;
27
- this.socketServer = void 0;
28
- this.watcher = void 0;
29
- this.devMiddleware = void 0;
24
+ _defineProperty(this, "mockHandler", null);
25
+
26
+ _defineProperty(this, "dev", void 0);
27
+
28
+ _defineProperty(this, "compiler", void 0);
29
+
30
+ _defineProperty(this, "socketServer", void 0);
31
+
32
+ _defineProperty(this, "watcher", void 0);
33
+
34
+ _defineProperty(this, "devMiddleware", void 0);
35
+
30
36
  this.workDir = this.pwd; // set webpack compiler
31
37
 
32
38
  this.compiler = options.compiler; // set dev server options, like webpack-dev-server
@@ -23,7 +23,8 @@ const {
23
23
 
24
24
  class DevServerPlugin {
25
25
  constructor(options) {
26
- this.options = void 0;
26
+ _defineProperty(this, "options", void 0);
27
+
27
28
  this.options = options;
28
29
  }
29
30
 
@@ -11,14 +11,22 @@ var _utils = require("@modern-js/utils");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
+
14
16
  class SocketServer {
15
17
  constructor(options) {
16
- this.wsServer = void 0;
17
- this.sockets = [];
18
- this.options = void 0;
19
- this.app = void 0;
20
- this.stats = void 0;
21
- this.timer = null;
18
+ _defineProperty(this, "wsServer", void 0);
19
+
20
+ _defineProperty(this, "sockets", []);
21
+
22
+ _defineProperty(this, "options", void 0);
23
+
24
+ _defineProperty(this, "app", void 0);
25
+
26
+ _defineProperty(this, "stats", void 0);
27
+
28
+ _defineProperty(this, "timer", null);
29
+
22
30
  this.options = options;
23
31
  } // create socket, install socket handler, bind socket event
24
32
 
@@ -9,6 +9,8 @@ var _minimatch = _interopRequireDefault(require("minimatch"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
12
14
  const defaultIgnores = ['**/bower_components/**', '**/coverage/**', '**/node_modules/**', '**/.*/**', '**/*.d.ts', '**/*.log'];
13
15
  exports.defaultIgnores = defaultIgnores;
14
16
 
@@ -19,8 +21,10 @@ exports.defaultIgnores = defaultIgnores;
19
21
  */
20
22
  class DependencyTree {
21
23
  constructor() {
22
- this.tree = void 0;
23
- this.ignore = void 0;
24
+ _defineProperty(this, "tree", void 0);
25
+
26
+ _defineProperty(this, "ignore", void 0);
27
+
24
28
  this.tree = new Map();
25
29
  this.ignore = [...defaultIgnores];
26
30
  }
@@ -15,6 +15,8 @@ var _statsCache = require("./stats-cache");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+
18
20
  const getWatchedFiles = watcher => {
19
21
  const watched = watcher.getWatched();
20
22
  const files = [];
@@ -30,8 +32,9 @@ exports.getWatchedFiles = getWatchedFiles;
30
32
 
31
33
  class Watcher {
32
34
  constructor() {
33
- this.dependencyTree = null;
34
- this.watcher = void 0;
35
+ _defineProperty(this, "dependencyTree", null);
36
+
37
+ _defineProperty(this, "watcher", void 0);
35
38
  }
36
39
 
37
40
  listen(files, options, callback) {
@@ -11,10 +11,13 @@ var _crypto = _interopRequireDefault(require("crypto"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
+
14
16
  class StatsCache {
15
17
  constructor() {
16
- this.cachedHash = {};
17
- this.cachedSize = {};
18
+ _defineProperty(this, "cachedHash", {});
19
+
20
+ _defineProperty(this, "cachedSize", {});
18
21
  }
19
22
 
20
23
  add(files) {
@@ -43,12 +43,18 @@ class ModernDevServer extends _prodServer.ModernServer {
43
43
  constructor(options) {
44
44
  super(options); // dev server should work in pwd
45
45
 
46
- this.mockHandler = null;
47
- this.dev = void 0;
48
- this.compiler = void 0;
49
- this.socketServer = void 0;
50
- this.watcher = void 0;
51
- this.devMiddleware = void 0;
46
+ _defineProperty(this, "mockHandler", null);
47
+
48
+ _defineProperty(this, "dev", void 0);
49
+
50
+ _defineProperty(this, "compiler", void 0);
51
+
52
+ _defineProperty(this, "socketServer", void 0);
53
+
54
+ _defineProperty(this, "watcher", void 0);
55
+
56
+ _defineProperty(this, "devMiddleware", void 0);
57
+
52
58
  this.workDir = this.pwd; // set webpack compiler
53
59
 
54
60
  this.compiler = options.compiler; // set dev server options, like webpack-dev-server
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.4.13",
14
+ "version": "1.4.14",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -30,11 +30,11 @@
30
30
  "dependencies": {
31
31
  "@babel/core": "^7.17.0",
32
32
  "@babel/register": "^7.15.3",
33
- "@modern-js/bff-utils": "^1.2.5",
34
- "@modern-js/hmr-client": "^1.2.6",
35
- "@modern-js/prod-server": "^1.1.4",
36
- "@modern-js/server-utils": "^1.2.5",
37
- "@modern-js/utils": "^1.7.2",
33
+ "@modern-js/bff-utils": "^1.2.6",
34
+ "@modern-js/hmr-client": "^1.2.7",
35
+ "@modern-js/prod-server": "^1.1.5",
36
+ "@modern-js/server-utils": "^1.2.6",
37
+ "@modern-js/utils": "^1.7.3",
38
38
  "devcert": "^1.1.3",
39
39
  "launch-editor": "^2.2.1",
40
40
  "minimatch": "^3.0.4",
@@ -44,12 +44,12 @@
44
44
  "ws": "^8.2.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@modern-js/core": "1.10.1",
48
- "@modern-js/server-core": "1.3.4",
49
- "@modern-js/types": "1.5.2",
47
+ "@modern-js/core": "1.10.2",
48
+ "@modern-js/server-core": "1.3.5",
49
+ "@modern-js/types": "1.5.3",
50
50
  "@scripts/build": "0.0.0",
51
51
  "@scripts/jest-config": "0.0.0",
52
- "@types/jest": "^26",
52
+ "@types/jest": "^27",
53
53
  "@types/minimatch": "^3.0.5",
54
54
  "@types/node": "^14",
55
55
  "@types/webpack-dev-middleware": "^5.0.2",
@@ -72,11 +72,33 @@
72
72
  "registry": "https://registry.npmjs.org/",
73
73
  "access": "public"
74
74
  },
75
+ "wireit": {
76
+ "build": {
77
+ "command": "modern build",
78
+ "files": [
79
+ "src/**/*",
80
+ "tsconfig.json",
81
+ "package.json"
82
+ ],
83
+ "output": [
84
+ "dist/**/*"
85
+ ]
86
+ },
87
+ "test": {
88
+ "command": "jest",
89
+ "files": [
90
+ "src/**/*",
91
+ "tsconfig.json",
92
+ "package.json"
93
+ ],
94
+ "output": []
95
+ }
96
+ },
75
97
  "scripts": {
76
98
  "new": "modern new",
77
- "build": "modern build",
99
+ "build": "wireit",
78
100
  "dev": "modern build --watch",
79
- "test": "jest"
101
+ "test": "wireit"
80
102
  },
81
103
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
82
104
  }
package/.eslintrc.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ['@modern-js'],
4
- parserOptions: {
5
- tsconfigRootDir: __dirname,
6
- project: ['./tsconfig.json'],
7
- },
8
- };
package/jest.config.js DELETED
@@ -1,8 +0,0 @@
1
- const sharedConfig = require('@scripts/jest-config');
2
-
3
- /** @type {import('@jest/types').Config.InitialOptions} */
4
- module.exports = {
5
- ...sharedConfig,
6
- testEnvironment: 'node',
7
- rootDir: __dirname,
8
- };
package/modern.config.js DELETED
@@ -1,6 +0,0 @@
1
- /** @type {import('@modern-js/module-tools').UserConfig} */
2
- module.exports = {
3
- output: {
4
- disableSourceMap: true,
5
- },
6
- };
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "jsx": "preserve",
6
- "baseUrl": "./",
7
- "esModuleInterop": true,
8
- "paths": {}
9
- },
10
- "include": ["src"]
11
- }