@modern-js/server 1.1.3-beta.1 → 1.1.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 +23 -0
- package/dist/js/modern/libs/render/cache/type.js +0 -1
- package/dist/js/modern/server/dev-server/dev-server.js +1 -1
- package/dist/js/modern/server/index.js +2 -1
- package/dist/js/modern/server/modern-server.js +1 -3
- package/dist/js/modern/type.js +0 -1
- package/dist/js/node/server/dev-server/dev-server.js +1 -1
- package/dist/js/node/server/index.js +2 -0
- package/dist/js/node/server/modern-server.js +1 -3
- package/package.json +15 -17
- package/src/server/dev-server/dev-server.ts +1 -1
- package/src/server/index.ts +3 -0
- package/src/server/modern-server.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @modern-js/server
|
|
2
2
|
|
|
3
|
+
## 1.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 085a6a58: refactor server plugin
|
|
8
|
+
- 085a6a58: refactor server plugin
|
|
9
|
+
- 085a6a58: refactor server conifg
|
|
10
|
+
- 085a6a58: support server runtime
|
|
11
|
+
- 085a6a58: feat: refactor server plugin
|
|
12
|
+
- Updated dependencies [085a6a58]
|
|
13
|
+
- Updated dependencies [085a6a58]
|
|
14
|
+
- Updated dependencies [085a6a58]
|
|
15
|
+
- Updated dependencies [d280ea33]
|
|
16
|
+
- Updated dependencies [d4fcc73a]
|
|
17
|
+
- Updated dependencies [085a6a58]
|
|
18
|
+
- Updated dependencies [ed1f6b12]
|
|
19
|
+
- Updated dependencies [a5ebbb00]
|
|
20
|
+
- Updated dependencies [085a6a58]
|
|
21
|
+
- @modern-js/core@1.1.3
|
|
22
|
+
- @modern-js/server-plugin@1.1.2
|
|
23
|
+
- @modern-js/server-utils@1.1.2
|
|
24
|
+
- @modern-js/utils@1.1.3
|
|
25
|
+
|
|
3
26
|
## 1.1.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -230,7 +230,7 @@ export class ModernDevServer extends ModernServer {
|
|
|
230
230
|
const {
|
|
231
231
|
mock
|
|
232
232
|
} = AGGRED_DIR;
|
|
233
|
-
const defaultWatched = [`${pwd}/${mock}/**/*`, `${pwd}/${SERVER_DIR}/**/*`, `${pwd}/${API_DIR}
|
|
233
|
+
const defaultWatched = [`${pwd}/${mock}/**/*`, `${pwd}/${SERVER_DIR}/**/*`, `${pwd}/${API_DIR}/!(typings)/**`, `${pwd}/${SHARED_DIR}/**/*`];
|
|
234
234
|
const watcher = new Watcher();
|
|
235
235
|
watcher.createDepTree(); // 监听文件变动,如果有变动则给 client,也就是 start 启动的插件发消息
|
|
236
236
|
|
|
@@ -7,7 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { serverManager } from '@modern-js/server-plugin';
|
|
9
9
|
import { logger as defaultLogger } from '@modern-js/utils';
|
|
10
|
-
import { AppContext, initAppContext, initAppDir, loadUserConfig } from '@modern-js/core';
|
|
10
|
+
import { AppContext, initAppContext, initAppDir, loadUserConfig, ConfigContext } from '@modern-js/core';
|
|
11
11
|
import { ModernServer } from "./modern-server";
|
|
12
12
|
import { APIModernServer, WebModernServer } from "./modern-server-split";
|
|
13
13
|
import { measure as defaultMeasure } from "../libs/measure";
|
|
@@ -115,6 +115,7 @@ export class Server {
|
|
|
115
115
|
} = this;
|
|
116
116
|
const appContext = await this.initAppContext();
|
|
117
117
|
serverManager.run(() => {
|
|
118
|
+
ConfigContext.set(this.options.config);
|
|
118
119
|
AppContext.set(_objectSpread(_objectSpread({}, appContext), {}, {
|
|
119
120
|
distDirectory: path.join(options.pwd, options.config.output.path || 'dist')
|
|
120
121
|
}));
|
|
@@ -231,9 +231,7 @@ export class ModernServer {
|
|
|
231
231
|
const mode = fs.existsSync(path.join(apiDir, AGGRED_DIR.lambda)) ? ApiServerMode.frame : ApiServerMode.func; // if use lambda/, mean framework style of writing, then discard user extension
|
|
232
232
|
|
|
233
233
|
const apiExtension = mergeExtension(pluginAPIExt);
|
|
234
|
-
this.frameAPIHandler = await this.prepareAPIHandler(mode,
|
|
235
|
-
modernJsConfig: this.conf
|
|
236
|
-
}));
|
|
234
|
+
this.frameAPIHandler = await this.prepareAPIHandler(mode, apiExtension);
|
|
237
235
|
}
|
|
238
236
|
}
|
|
239
237
|
/* —————————————————————— function will be overwrite —————————————————————— */
|
package/dist/js/modern/type.js
CHANGED
|
@@ -259,7 +259,7 @@ class ModernDevServer extends _modernServer.ModernServer {
|
|
|
259
259
|
const {
|
|
260
260
|
mock
|
|
261
261
|
} = _constants.AGGRED_DIR;
|
|
262
|
-
const defaultWatched = [`${pwd}/${mock}/**/*`, `${pwd}/${_utils.SERVER_DIR}/**/*`, `${pwd}/${_utils.API_DIR}
|
|
262
|
+
const defaultWatched = [`${pwd}/${mock}/**/*`, `${pwd}/${_utils.SERVER_DIR}/**/*`, `${pwd}/${_utils.API_DIR}/!(typings)/**`, `${pwd}/${_utils.SHARED_DIR}/**/*`];
|
|
263
263
|
const watcher = new _watcher.default();
|
|
264
264
|
watcher.createDepTree(); // 监听文件变动,如果有变动则给 client,也就是 start 启动的插件发消息
|
|
265
265
|
|
|
@@ -132,6 +132,8 @@ class Server {
|
|
|
132
132
|
const appContext = await this.initAppContext();
|
|
133
133
|
|
|
134
134
|
_serverPlugin.serverManager.run(() => {
|
|
135
|
+
_core.ConfigContext.set(this.options.config);
|
|
136
|
+
|
|
135
137
|
_core.AppContext.set(_objectSpread(_objectSpread({}, appContext), {}, {
|
|
136
138
|
distDirectory: _path.default.join(options.pwd, options.config.output.path || 'dist')
|
|
137
139
|
}));
|
|
@@ -266,9 +266,7 @@ class ModernServer {
|
|
|
266
266
|
const mode = _utils.fs.existsSync(_path.default.join(apiDir, _constants.AGGRED_DIR.lambda)) ? _constants.ApiServerMode.frame : _constants.ApiServerMode.func; // if use lambda/, mean framework style of writing, then discard user extension
|
|
267
267
|
|
|
268
268
|
const apiExtension = (0, _utils2.mergeExtension)(pluginAPIExt);
|
|
269
|
-
this.frameAPIHandler = await this.prepareAPIHandler(mode,
|
|
270
|
-
modernJsConfig: this.conf
|
|
271
|
-
}));
|
|
269
|
+
this.frameAPIHandler = await this.prepareAPIHandler(mode, apiExtension);
|
|
272
270
|
}
|
|
273
271
|
}
|
|
274
272
|
/* —————————————————————— function will be overwrite —————————————————————— */
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.1.3
|
|
14
|
+
"version": "1.1.3",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -26,14 +26,6 @@
|
|
|
26
26
|
"default": "./dist/js/treeshaking/index.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"prepare": "pnpm build",
|
|
31
|
-
"prepublishOnly": "pnpm build --platform",
|
|
32
|
-
"new": "modern new",
|
|
33
|
-
"build": "modern build",
|
|
34
|
-
"dev": "modern build --watch",
|
|
35
|
-
"test": "modern test --passWithNoTests"
|
|
36
|
-
},
|
|
37
29
|
"dependencies": {
|
|
38
30
|
"@babel/core": "^7.15.0",
|
|
39
31
|
"@babel/compat-data": "^7.15.0",
|
|
@@ -41,12 +33,12 @@
|
|
|
41
33
|
"@babel/preset-typescript": "^7.15.0",
|
|
42
34
|
"@babel/register": "^7.15.3",
|
|
43
35
|
"@babel/runtime": "^7",
|
|
44
|
-
"@modern-js/core": "
|
|
45
|
-
"@modern-js/hmr-client": "
|
|
46
|
-
"@modern-js/server-plugin": "
|
|
47
|
-
"@modern-js/server-utils": "
|
|
48
|
-
"@modern-js/bff-utils": "
|
|
49
|
-
"@modern-js/utils": "
|
|
36
|
+
"@modern-js/core": "^1.1.3",
|
|
37
|
+
"@modern-js/hmr-client": "^1.1.1",
|
|
38
|
+
"@modern-js/server-plugin": "^1.1.2",
|
|
39
|
+
"@modern-js/server-utils": "^1.1.2",
|
|
40
|
+
"@modern-js/bff-utils": "^1.1.1",
|
|
41
|
+
"@modern-js/utils": "^1.1.3",
|
|
50
42
|
"axios": "^0.21.4",
|
|
51
43
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
52
44
|
"chokidar": "^3.5.2",
|
|
@@ -71,7 +63,7 @@
|
|
|
71
63
|
"devDependencies": {
|
|
72
64
|
"@modern-js/module-tools": "^1.1.1",
|
|
73
65
|
"@modern-js/plugin-testing": "^1.1.1",
|
|
74
|
-
"@modern-js/types": "
|
|
66
|
+
"@modern-js/types": "^1.1.2",
|
|
75
67
|
"@types/jest": "^26",
|
|
76
68
|
"@types/lru-cache": "^5.1.1",
|
|
77
69
|
"@types/mime-types": "^2.1.0",
|
|
@@ -100,5 +92,11 @@
|
|
|
100
92
|
"publishConfig": {
|
|
101
93
|
"registry": "https://registry.npmjs.org/",
|
|
102
94
|
"access": "public"
|
|
95
|
+
},
|
|
96
|
+
"scripts": {
|
|
97
|
+
"new": "modern new",
|
|
98
|
+
"build": "modern build",
|
|
99
|
+
"dev": "modern build --watch",
|
|
100
|
+
"test": "modern test --passWithNoTests"
|
|
103
101
|
}
|
|
104
|
-
}
|
|
102
|
+
}
|
|
@@ -252,7 +252,7 @@ export class ModernDevServer extends ModernServer {
|
|
|
252
252
|
const defaultWatched = [
|
|
253
253
|
`${pwd}/${mock}/**/*`,
|
|
254
254
|
`${pwd}/${SERVER_DIR}/**/*`,
|
|
255
|
-
`${pwd}/${API_DIR}
|
|
255
|
+
`${pwd}/${API_DIR}/!(typings)/**`,
|
|
256
256
|
`${pwd}/${SHARED_DIR}/**/*`,
|
|
257
257
|
];
|
|
258
258
|
|
package/src/server/index.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
initAppContext,
|
|
8
8
|
initAppDir,
|
|
9
9
|
loadUserConfig,
|
|
10
|
+
ConfigContext,
|
|
11
|
+
UserConfig,
|
|
10
12
|
} from '@modern-js/core';
|
|
11
13
|
import { ModernServer } from './modern-server';
|
|
12
14
|
import type { ModernDevServer } from './dev-server';
|
|
@@ -117,6 +119,7 @@ export class Server {
|
|
|
117
119
|
const { options } = this;
|
|
118
120
|
const appContext = await this.initAppContext();
|
|
119
121
|
serverManager.run(() => {
|
|
122
|
+
ConfigContext.set(this.options.config as UserConfig);
|
|
120
123
|
AppContext.set({
|
|
121
124
|
...appContext,
|
|
122
125
|
distDirectory: path.join(
|
|
@@ -272,10 +272,7 @@ export class ModernServer {
|
|
|
272
272
|
|
|
273
273
|
// if use lambda/, mean framework style of writing, then discard user extension
|
|
274
274
|
const apiExtension = mergeExtension(pluginAPIExt);
|
|
275
|
-
this.frameAPIHandler = await this.prepareAPIHandler(mode,
|
|
276
|
-
...apiExtension,
|
|
277
|
-
modernJsConfig: this.conf,
|
|
278
|
-
});
|
|
275
|
+
this.frameAPIHandler = await this.prepareAPIHandler(mode, apiExtension);
|
|
279
276
|
}
|
|
280
277
|
}
|
|
281
278
|
|