@midwayjs/view 3.5.2 → 3.6.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2013 - Now midwayjs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -16,7 +16,7 @@ $ npm i @midwayjs/view-ejs --save
16
16
  First, import component in `src/configuration.ts`.
17
17
 
18
18
  ```typescript
19
- import { Configuration } from '@midwayjs/decorator';
19
+ import { Configuration } from '@midwayjs/core';
20
20
  import * as view from '@midwayjs/view-ejs';
21
21
  import { join } from 'path'
22
22
 
@@ -51,7 +51,7 @@ export const ejs = {};
51
51
  In controller, you can call `ctx.render`.
52
52
 
53
53
  ```typescript
54
- import { Inject, Provide } from '@midwayjs/decorator';
54
+ import { Inject, Provide } from '@midwayjs/core';
55
55
  import { Context } from '@midwayjs/koa';
56
56
 
57
57
  @Controller('/')
@@ -98,7 +98,7 @@ Create a view engine class first, and implement render and renderString, if the
98
98
 
99
99
  ```typescript
100
100
  // lib/view.ts
101
- import { Provide } from '@midwayjs/decorator';
101
+ import { Provide } from '@midwayjs/core';
102
102
 
103
103
  @Provide()
104
104
  export class MyView {
@@ -138,7 +138,7 @@ After define a view engine, you can register it.
138
138
 
139
139
  ```typescript
140
140
  // src/configuration.ts
141
- import { Configuration, Inject, Provide } from '@midwayjs/decorator';
141
+ import { Configuration, Inject, Provide } from '@midwayjs/core';
142
142
  import * as koa from '@midwayjs/koa';
143
143
  import * as view from '@midwayjs/view';
144
144
  import { MyView } from './lib/my';
@@ -192,7 +192,7 @@ export const view = {
192
192
  };
193
193
 
194
194
  // controller
195
- import { Inject, Provide } from '@midwayjs/decorator';
195
+ import { Inject, Provide } from '@midwayjs/core';
196
196
  import { Context } from '@midwayjs/koa';
197
197
 
198
198
  @Controller('/')
@@ -10,11 +10,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ViewConfiguration = void 0;
13
- const decorator_1 = require("@midwayjs/decorator");
13
+ const core_1 = require("@midwayjs/core");
14
14
  const DefaultConfig = require("./config/config.default");
15
15
  const LocalConfig = require("./config/config.local");
16
16
  const viewManager_1 = require("./viewManager");
17
- const core_1 = require("@midwayjs/core");
18
17
  const contextView_1 = require("./contextView");
19
18
  let ViewConfiguration = class ViewConfiguration {
20
19
  async onReady(container) {
@@ -60,11 +59,11 @@ let ViewConfiguration = class ViewConfiguration {
60
59
  }
61
60
  };
62
61
  __decorate([
63
- (0, decorator_1.Inject)(),
62
+ (0, core_1.Inject)(),
64
63
  __metadata("design:type", core_1.MidwayApplicationManager)
65
64
  ], ViewConfiguration.prototype, "applicationManager", void 0);
66
65
  ViewConfiguration = __decorate([
67
- (0, decorator_1.Configuration)({
66
+ (0, core_1.Configuration)({
68
67
  namespace: 'view',
69
68
  importConfigs: [
70
69
  {
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ContextView = void 0;
13
13
  const viewManager_1 = require("./viewManager");
14
- const decorator_1 = require("@midwayjs/decorator");
14
+ const core_1 = require("@midwayjs/core");
15
15
  const assert = require("assert");
16
16
  const path_1 = require("path");
17
17
  /**
@@ -61,10 +61,10 @@ let ContextView = class ContextView {
61
61
  const engine = await this.ctx.requestContext.getAsync(ViewEngine);
62
62
  // wrap render and renderString to support both async function and generator function
63
63
  if (engine.render) {
64
- engine.render = decorator_1.Utils.toAsyncFunction(engine.render);
64
+ engine.render = core_1.Utils.toAsyncFunction(engine.render);
65
65
  }
66
66
  if (engine.renderString) {
67
- engine.renderString = decorator_1.Utils.toAsyncFunction(engine.renderString);
67
+ engine.renderString = core_1.Utils.toAsyncFunction(engine.renderString);
68
68
  }
69
69
  return engine;
70
70
  }
@@ -76,19 +76,19 @@ let ContextView = class ContextView {
76
76
  }
77
77
  };
78
78
  __decorate([
79
- (0, decorator_1.Inject)(),
79
+ (0, core_1.Inject)(),
80
80
  __metadata("design:type", viewManager_1.ViewManager)
81
81
  ], ContextView.prototype, "viewManager", void 0);
82
82
  __decorate([
83
- (0, decorator_1.Config)('view'),
83
+ (0, core_1.Config)('view'),
84
84
  __metadata("design:type", Object)
85
85
  ], ContextView.prototype, "viewConfig", void 0);
86
86
  __decorate([
87
- (0, decorator_1.Inject)(),
87
+ (0, core_1.Inject)(),
88
88
  __metadata("design:type", Object)
89
89
  ], ContextView.prototype, "ctx", void 0);
90
90
  ContextView = __decorate([
91
- (0, decorator_1.Provide)()
91
+ (0, core_1.Provide)()
92
92
  ], ContextView);
93
93
  exports.ContextView = ContextView;
94
94
  //# sourceMappingURL=contextView.js.map
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ViewManager = void 0;
13
- const decorator_1 = require("@midwayjs/decorator");
13
+ const core_1 = require("@midwayjs/core");
14
14
  const assert = require("assert");
15
15
  const path = require("path");
16
16
  const fs_1 = require("fs");
@@ -99,22 +99,22 @@ let ViewManager = class ViewManager extends Map {
99
99
  }
100
100
  };
101
101
  __decorate([
102
- (0, decorator_1.App)(),
102
+ (0, core_1.App)(),
103
103
  __metadata("design:type", Object)
104
104
  ], ViewManager.prototype, "app", void 0);
105
105
  __decorate([
106
- (0, decorator_1.Config)('view'),
106
+ (0, core_1.Config)('view'),
107
107
  __metadata("design:type", Object)
108
108
  ], ViewManager.prototype, "viewConfig", void 0);
109
109
  __decorate([
110
- (0, decorator_1.Init)(),
110
+ (0, core_1.Init)(),
111
111
  __metadata("design:type", Function),
112
112
  __metadata("design:paramtypes", []),
113
113
  __metadata("design:returntype", void 0)
114
114
  ], ViewManager.prototype, "init", null);
115
115
  ViewManager = __decorate([
116
- (0, decorator_1.Provide)(),
117
- (0, decorator_1.Scope)(decorator_1.ScopeEnum.Singleton)
116
+ (0, core_1.Provide)(),
117
+ (0, core_1.Scope)(core_1.ScopeEnum.Singleton)
118
118
  ], ViewManager);
119
119
  exports.ViewManager = ViewManager;
120
120
  async function resolvePath(names, root) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/view",
3
- "version": "3.5.2",
3
+ "version": "3.6.0",
4
4
  "description": "Midway Component for render view",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/core": "^3.5.1",
31
- "@midwayjs/decorator": "^3.4.11",
32
- "@midwayjs/koa": "^3.5.1",
33
- "@midwayjs/mock": "^3.5.1"
34
- }
30
+ "@midwayjs/core": "^3.6.0",
31
+ "@midwayjs/koa": "^3.6.0",
32
+ "@midwayjs/mock": "^3.6.0"
33
+ },
34
+ "gitHead": "22643b0e8519766bb7c68b975930199fc136336e"
35
35
  }