@midwayjs/view 4.0.0-beta.1 → 4.0.0-beta.10

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/README.md CHANGED
@@ -225,4 +225,4 @@ export const view = {
225
225
 
226
226
  ## License
227
227
 
228
- [MIT]((https://github.com/midwayjs/midway/blob/master/LICENSE))
228
+ [MIT](https://github.com/midwayjs/midway/blob/master/LICENSE)
@@ -16,6 +16,7 @@ const LocalConfig = require("./config/config.local");
16
16
  const viewManager_1 = require("./viewManager");
17
17
  const contextView_1 = require("./contextView");
18
18
  let ViewConfiguration = class ViewConfiguration {
19
+ applicationManager;
19
20
  async onReady(container) {
20
21
  this.applicationManager
21
22
  .getApplications(['koa', 'egg', 'faas'])
@@ -28,9 +29,7 @@ let ViewConfiguration = class ViewConfiguration {
28
29
  render: {
29
30
  value: async function (...args) {
30
31
  const contextView = await this.requestContext.getAsync(contextView_1.ContextView);
31
- return contextView.render(...args).then(body => {
32
- this.body = body;
33
- });
32
+ this.body = await contextView.render(...args);
34
33
  },
35
34
  },
36
35
  /**
@@ -40,7 +39,7 @@ let ViewConfiguration = class ViewConfiguration {
40
39
  renderView: {
41
40
  value: async function (...args) {
42
41
  const contextView = await this.requestContext.getAsync(contextView_1.ContextView);
43
- return contextView.render(...args);
42
+ return await contextView.render(...args);
44
43
  },
45
44
  },
46
45
  /**
@@ -50,7 +49,7 @@ let ViewConfiguration = class ViewConfiguration {
50
49
  renderString: {
51
50
  value: async function (...args) {
52
51
  const contextView = await this.requestContext.getAsync(contextView_1.ContextView);
53
- return contextView.renderString(...args);
52
+ return await contextView.renderString(...args);
54
53
  },
55
54
  },
56
55
  });
@@ -21,6 +21,9 @@ const path_1 = require("path");
21
21
  * The view engine should be registered in {@link ViewManager}.
22
22
  */
23
23
  let ContextView = class ContextView {
24
+ viewManager;
25
+ viewConfig;
26
+ ctx;
24
27
  async render(name, locals, options) {
25
28
  // retrieve fullpath matching name from `config.root`
26
29
  const filename = await this.viewManager.resolve(name);
@@ -15,12 +15,12 @@ const assert = require("assert");
15
15
  const path = require("path");
16
16
  const fs_1 = require("fs");
17
17
  let ViewManager = class ViewManager extends Map {
18
- constructor() {
19
- super(...arguments);
20
- this.extMap = new Map();
21
- this.fileMap = new Map();
22
- this.localsMap = {};
23
- }
18
+ app;
19
+ viewConfig;
20
+ config;
21
+ extMap = new Map();
22
+ fileMap = new Map();
23
+ localsMap = {};
24
24
  init() {
25
25
  this.config = this.viewConfig;
26
26
  const rootSet = new Set(Object.values(this.config.rootDir));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/view",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "Midway Component for render view",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -23,13 +23,13 @@
23
23
  "index.d.ts"
24
24
  ],
25
25
  "engines": {
26
- "node": ">=12"
26
+ "node": ">=20"
27
27
  },
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/core": "^4.0.0-beta.1",
31
- "@midwayjs/koa": "^4.0.0-beta.1",
32
- "@midwayjs/mock": "^4.0.0-beta.1"
30
+ "@midwayjs/core": "^4.0.0-beta.10",
31
+ "@midwayjs/koa": "^4.0.0-beta.10",
32
+ "@midwayjs/mock": "^4.0.0-beta.10"
33
33
  },
34
- "gitHead": "832961ec3aff123c033197d8c00cb2bc9bad7ff8"
34
+ "gitHead": "1b1856629913703f67304155aaf611ec936a81ac"
35
35
  }