@tsed/platform-views 6.88.0 → 6.91.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/lib/{decorators → cjs/decorators}/view.d.ts +0 -0
- package/lib/cjs/decorators/view.js +31 -0
- package/lib/cjs/decorators/view.js.map +1 -0
- package/lib/{domain → cjs/domain}/PlatformViewsSettings.d.ts +0 -0
- package/lib/cjs/domain/PlatformViewsSettings.js +47 -0
- package/lib/cjs/domain/PlatformViewsSettings.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformViews.d.ts +0 -0
- package/lib/cjs/services/PlatformViews.js +166 -0
- package/lib/cjs/services/PlatformViews.js.map +1 -0
- package/lib/esm/decorators/view.js +27 -0
- package/lib/esm/decorators/view.js.map +1 -0
- package/lib/esm/domain/PlatformViewsSettings.js +44 -0
- package/lib/esm/domain/PlatformViewsSettings.js.map +1 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/services/PlatformViews.js +163 -0
- package/lib/esm/services/PlatformViews.js.map +1 -0
- package/lib/types/decorators/view.d.ts +23 -0
- package/lib/types/domain/PlatformViewsSettings.d.ts +89 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/services/PlatformViews.d.ts +34 -0
- package/package.json +18 -14
- package/tsconfig.compile.esm.json +23 -0
- package/lib/index.js +0 -333
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -308
- package/lib/index.modern.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BaseContext } from "@tsed/di";
|
|
2
|
+
export declare const PLATFORM_VIEWS_EXTENSIONS: {
|
|
3
|
+
atpl: string;
|
|
4
|
+
bracket: string;
|
|
5
|
+
dot: string;
|
|
6
|
+
dust: string;
|
|
7
|
+
ect: string;
|
|
8
|
+
ejs: string;
|
|
9
|
+
haml: string;
|
|
10
|
+
"haml-coffee": string;
|
|
11
|
+
hamlet: string;
|
|
12
|
+
hbs: string;
|
|
13
|
+
handlebars: string;
|
|
14
|
+
hogan: string;
|
|
15
|
+
htmling: string;
|
|
16
|
+
jazz: string;
|
|
17
|
+
jqtpl: string;
|
|
18
|
+
just: string;
|
|
19
|
+
kernel: string;
|
|
20
|
+
liquid: string;
|
|
21
|
+
liquor: string;
|
|
22
|
+
lodash: string;
|
|
23
|
+
mote: string;
|
|
24
|
+
mustache: string;
|
|
25
|
+
nunjucks: string;
|
|
26
|
+
plates: string;
|
|
27
|
+
pug: string;
|
|
28
|
+
qejs: string;
|
|
29
|
+
ractive: string;
|
|
30
|
+
razor: string;
|
|
31
|
+
jsx: string;
|
|
32
|
+
slm: string;
|
|
33
|
+
squirelly: string;
|
|
34
|
+
swig: string;
|
|
35
|
+
teacup: string;
|
|
36
|
+
templayed: string;
|
|
37
|
+
toffee: string;
|
|
38
|
+
twig: string;
|
|
39
|
+
underscore: string;
|
|
40
|
+
vash: string;
|
|
41
|
+
velocityjs: string;
|
|
42
|
+
walrus: string;
|
|
43
|
+
whiskers: string;
|
|
44
|
+
};
|
|
45
|
+
export declare type PlatformViewsExtensionsTypes = Record<string, string>;
|
|
46
|
+
export interface PlatformViewsEngineOptions extends Record<string, unknown> {
|
|
47
|
+
requires?: any;
|
|
48
|
+
}
|
|
49
|
+
export interface PlatformRenderOptions extends Record<string, unknown> {
|
|
50
|
+
$ctx: BaseContext;
|
|
51
|
+
}
|
|
52
|
+
export interface PlatformViewEngine {
|
|
53
|
+
options: PlatformViewsEngineOptions;
|
|
54
|
+
render(path: string, options: PlatformRenderOptions): Promise<string>;
|
|
55
|
+
}
|
|
56
|
+
export interface PlatformViewsSettings {
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Views directory.
|
|
60
|
+
*/
|
|
61
|
+
root?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Enable cache. Ts.ED enable cache in PRODUCTION profile by default.
|
|
64
|
+
*/
|
|
65
|
+
cache?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Provide extensions mapping to match the expected engines.
|
|
68
|
+
*/
|
|
69
|
+
extensions?: Partial<PlatformViewsExtensionsTypes>;
|
|
70
|
+
/**
|
|
71
|
+
* Default view engine extension.
|
|
72
|
+
* Allow omitting extension when using View decorator or render method.
|
|
73
|
+
*/
|
|
74
|
+
viewEngine?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Options mapping for each engine.
|
|
77
|
+
*/
|
|
78
|
+
options?: Record<string, PlatformViewsEngineOptions>;
|
|
79
|
+
}
|
|
80
|
+
declare global {
|
|
81
|
+
namespace TsED {
|
|
82
|
+
interface Configuration {
|
|
83
|
+
/**
|
|
84
|
+
* Object to configure Views engines with Consolidate. See more on [View engine](/docs/template-engine.md).
|
|
85
|
+
*/
|
|
86
|
+
views: PlatformViewsSettings;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Env } from "@tsed/core";
|
|
2
|
+
import { PlatformViewEngine, PlatformViewsEngineOptions, PlatformViewsExtensionsTypes } from "../domain/PlatformViewsSettings";
|
|
3
|
+
/**
|
|
4
|
+
* @platform
|
|
5
|
+
*/
|
|
6
|
+
export declare class PlatformViews {
|
|
7
|
+
#private;
|
|
8
|
+
env: Env;
|
|
9
|
+
readonly root: string;
|
|
10
|
+
readonly cache: boolean;
|
|
11
|
+
readonly disabled: string;
|
|
12
|
+
readonly viewEngine: string;
|
|
13
|
+
protected extensionsOptions: PlatformViewsExtensionsTypes;
|
|
14
|
+
protected engineOptions: Record<string, PlatformViewsEngineOptions>;
|
|
15
|
+
$onInit(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
19
|
+
loadFromConsolidate(): Promise<void>;
|
|
20
|
+
loadFromTsedEngines(): Promise<void>;
|
|
21
|
+
getEngines(): {
|
|
22
|
+
extension: string;
|
|
23
|
+
engine: PlatformViewEngine;
|
|
24
|
+
}[];
|
|
25
|
+
registerEngine(engineType: string, engine: PlatformViewEngine): this;
|
|
26
|
+
getEngine(type: string): PlatformViewEngine | undefined;
|
|
27
|
+
getEngineOptions(engineType: string): PlatformViewsEngineOptions;
|
|
28
|
+
render(viewPath: string, options?: any): Promise<string>;
|
|
29
|
+
protected getExtension(viewPath: string): string;
|
|
30
|
+
protected resolve(viewPath: string): {
|
|
31
|
+
path: string;
|
|
32
|
+
extension: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-views",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.91.0",
|
|
4
4
|
"description": "Views module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
|
-
"typings": "./lib/index.d.ts",
|
|
7
|
+
"main": "./lib/cjs/index.js",
|
|
8
|
+
"typings": "./lib/types/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"import": "./lib/esm/index.js",
|
|
12
|
+
"require": "./lib/cjs/index.js",
|
|
13
|
+
"default": "./lib/esm/index.js"
|
|
12
14
|
},
|
|
13
15
|
"scripts": {
|
|
14
|
-
"build": "
|
|
16
|
+
"build": "yarn run build:esm && yarn run build:cjs",
|
|
17
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
18
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json"
|
|
15
19
|
},
|
|
16
20
|
"dependencies": {
|
|
17
21
|
"consolidate": "^0.16.0",
|
|
@@ -19,19 +23,19 @@
|
|
|
19
23
|
"tslib": "2.2.0"
|
|
20
24
|
},
|
|
21
25
|
"devDependencies": {
|
|
22
|
-
"@tsed/core": "6.
|
|
23
|
-
"@tsed/di": "6.
|
|
26
|
+
"@tsed/core": "6.91.0",
|
|
27
|
+
"@tsed/di": "6.91.0",
|
|
24
28
|
"@tsed/engines": "^1.1.5",
|
|
25
|
-
"@tsed/exceptions": "6.
|
|
26
|
-
"@tsed/schema": "6.
|
|
29
|
+
"@tsed/exceptions": "6.91.0",
|
|
30
|
+
"@tsed/schema": "6.91.0",
|
|
27
31
|
"@types/consolidate": "0.14.0"
|
|
28
32
|
},
|
|
29
33
|
"peerDependencies": {
|
|
30
|
-
"@tsed/core": "^6.
|
|
31
|
-
"@tsed/di": "^6.
|
|
34
|
+
"@tsed/core": "^6.91.0",
|
|
35
|
+
"@tsed/di": "^6.91.0",
|
|
32
36
|
"@tsed/engines": "^1.1.5",
|
|
33
|
-
"@tsed/exceptions": "^6.
|
|
34
|
-
"@tsed/schema": "^6.
|
|
37
|
+
"@tsed/exceptions": "^6.91.0",
|
|
38
|
+
"@tsed/schema": "^6.91.0"
|
|
35
39
|
},
|
|
36
40
|
"repository": "https://github.com/tsedio/tsed",
|
|
37
41
|
"bugs": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"node_modules",
|
|
13
|
+
"test",
|
|
14
|
+
"lib",
|
|
15
|
+
"benchmark",
|
|
16
|
+
"coverage",
|
|
17
|
+
"spec",
|
|
18
|
+
"**/*.benchmark.ts",
|
|
19
|
+
"**/*.spec.ts",
|
|
20
|
+
"keys",
|
|
21
|
+
"jest.config.js"
|
|
22
|
+
]
|
|
23
|
+
}
|
package/lib/index.js
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
var core = require('@tsed/core');
|
|
2
|
-
var tslib = require('tslib');
|
|
3
|
-
var di = require('@tsed/di');
|
|
4
|
-
var Fs = require('fs');
|
|
5
|
-
var path = require('path');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return e[k];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
n['default'] = e;
|
|
26
|
-
return n;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var Fs__default = /*#__PURE__*/_interopDefaultLegacy(Fs);
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Use a view and sends the rendered HTML string to the client. Optional parameter:
|
|
33
|
-
*
|
|
34
|
-
* * viewOptions, an object whose properties define local variables for the view.
|
|
35
|
-
*
|
|
36
|
-
* The view argument is a string that is the file path of the view file to render.
|
|
37
|
-
* This can be an absolute path, or a path relative to the views setting.
|
|
38
|
-
* If the path does not contain a file extension, then the view engine setting determines the file extension.
|
|
39
|
-
* If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
|
|
40
|
-
* and render it using the loaded module’s __express function.
|
|
41
|
-
*
|
|
42
|
-
* For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
|
|
43
|
-
*
|
|
44
|
-
* > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
|
|
45
|
-
* and as so for security reasons should not contain input from the end-user.
|
|
46
|
-
*
|
|
47
|
-
* @param path Relative path to the view file.
|
|
48
|
-
* @param options Additional options
|
|
49
|
-
* @decorator
|
|
50
|
-
* @operation
|
|
51
|
-
* @response
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
function View(path, options) {
|
|
55
|
-
return core.StoreSet("view", {
|
|
56
|
-
path,
|
|
57
|
-
options
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const PLATFORM_VIEWS_EXTENSIONS = {
|
|
62
|
-
atpl: "atpl",
|
|
63
|
-
bracket: "bracket",
|
|
64
|
-
dot: "dot",
|
|
65
|
-
dust: "dust",
|
|
66
|
-
ect: "ect",
|
|
67
|
-
ejs: "ejs",
|
|
68
|
-
haml: "haml",
|
|
69
|
-
"haml-coffee": "haml-coffee",
|
|
70
|
-
hamlet: "hamlet",
|
|
71
|
-
hbs: "handlebars",
|
|
72
|
-
handlebars: "handlebars",
|
|
73
|
-
hogan: "hogan",
|
|
74
|
-
htmling: "htmling",
|
|
75
|
-
jazz: "jazz",
|
|
76
|
-
jqtpl: "jqtpl",
|
|
77
|
-
just: "just",
|
|
78
|
-
kernel: "kernel",
|
|
79
|
-
liquid: "liquid",
|
|
80
|
-
liquor: "liquor",
|
|
81
|
-
lodash: "lodash",
|
|
82
|
-
mote: "mote",
|
|
83
|
-
mustache: "mustache",
|
|
84
|
-
nunjucks: "nunjucks",
|
|
85
|
-
plates: "plates",
|
|
86
|
-
pug: "pug",
|
|
87
|
-
qejs: "qejs",
|
|
88
|
-
ractive: "ractive",
|
|
89
|
-
razor: "razor",
|
|
90
|
-
jsx: "react",
|
|
91
|
-
slm: "slm",
|
|
92
|
-
squirelly: "squirelly",
|
|
93
|
-
swig: "swig",
|
|
94
|
-
teacup: "teacup",
|
|
95
|
-
templayed: "templayed",
|
|
96
|
-
toffee: "toffee",
|
|
97
|
-
twig: "twig",
|
|
98
|
-
underscore: "underscore",
|
|
99
|
-
vash: "vash",
|
|
100
|
-
velocityjs: "velocityjs",
|
|
101
|
-
walrus: "walrus",
|
|
102
|
-
whiskers: "whiskers"
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
function _extends() {
|
|
106
|
-
_extends = Object.assign || function (target) {
|
|
107
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
108
|
-
var source = arguments[i];
|
|
109
|
-
|
|
110
|
-
for (var key in source) {
|
|
111
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
112
|
-
target[key] = source[key];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return target;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return _extends.apply(this, arguments);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
124
|
-
if (source == null) return {};
|
|
125
|
-
var target = {};
|
|
126
|
-
var sourceKeys = Object.keys(source);
|
|
127
|
-
var key, i;
|
|
128
|
-
|
|
129
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
130
|
-
key = sourceKeys[i];
|
|
131
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
132
|
-
target[key] = source[key];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return target;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
var id = 0;
|
|
139
|
-
|
|
140
|
-
function _classPrivateFieldLooseKey(name) {
|
|
141
|
-
return "__private_" + id++ + "_" + name;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _classPrivateFieldLooseBase(receiver, privateKey) {
|
|
145
|
-
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
146
|
-
throw new TypeError("attempted to use private field on non-instance");
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return receiver;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
var _extensions, _engines, _cachePaths;
|
|
153
|
-
|
|
154
|
-
const _excluded = ["client"];
|
|
155
|
-
|
|
156
|
-
function patchEJS(ejs) {
|
|
157
|
-
return {
|
|
158
|
-
compile(str, _ref) {
|
|
159
|
-
let options = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
160
|
-
|
|
161
|
-
return (ejs || require("ejs")).compile(str, options);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async function tryImport(name) {
|
|
168
|
-
try {
|
|
169
|
-
return await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(name)); });
|
|
170
|
-
} catch (er) {// istanbul ignore next
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* @platform
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
exports.PlatformViews = (_extensions = /*#__PURE__*/_classPrivateFieldLooseKey("extensions"), _engines = /*#__PURE__*/_classPrivateFieldLooseKey("engines"), _cachePaths = /*#__PURE__*/_classPrivateFieldLooseKey("cachePaths"), class PlatformViews {
|
|
179
|
-
constructor() {
|
|
180
|
-
Object.defineProperty(this, _extensions, {
|
|
181
|
-
writable: true,
|
|
182
|
-
value: void 0
|
|
183
|
-
});
|
|
184
|
-
Object.defineProperty(this, _engines, {
|
|
185
|
-
writable: true,
|
|
186
|
-
value: void 0
|
|
187
|
-
});
|
|
188
|
-
Object.defineProperty(this, _cachePaths, {
|
|
189
|
-
writable: true,
|
|
190
|
-
value: void 0
|
|
191
|
-
});
|
|
192
|
-
_classPrivateFieldLooseBase(this, _engines)[_engines] = new Map();
|
|
193
|
-
_classPrivateFieldLooseBase(this, _cachePaths)[_cachePaths] = new Map();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async $onInit() {
|
|
197
|
-
if (!this.disabled) {
|
|
198
|
-
_classPrivateFieldLooseBase(this, _extensions)[_extensions] = new Map(Object.entries(_extends({}, PLATFORM_VIEWS_EXTENSIONS, this.extensionsOptions)));
|
|
199
|
-
await this.loadFromConsolidate();
|
|
200
|
-
await this.loadFromTsedEngines();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* @deprecated
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
async loadFromConsolidate() {
|
|
209
|
-
const cons = await tryImport("consolidate");
|
|
210
|
-
|
|
211
|
-
if (cons) {
|
|
212
|
-
cons.requires.ejs = patchEJS(cons.requires.ejs);
|
|
213
|
-
|
|
214
|
-
_classPrivateFieldLooseBase(this, _extensions)[_extensions].forEach(engineType => {
|
|
215
|
-
if (cons[engineType]) {
|
|
216
|
-
const options = this.getEngineOptions(engineType);
|
|
217
|
-
|
|
218
|
-
if (options.requires) {
|
|
219
|
-
cons.requires[engineType] = options.requires;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
this.registerEngine(engineType, {
|
|
223
|
-
options,
|
|
224
|
-
render: cons[engineType]
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async loadFromTsedEngines() {
|
|
232
|
-
const tsed = await tryImport("@tsed/engines");
|
|
233
|
-
|
|
234
|
-
if (tsed) {
|
|
235
|
-
tsed.requires.set("ejs", patchEJS(tsed.requires.get("ejs")));
|
|
236
|
-
|
|
237
|
-
_classPrivateFieldLooseBase(this, _extensions)[_extensions].forEach(engineType => {
|
|
238
|
-
if (tsed.engines.has(engineType)) {
|
|
239
|
-
const options = this.getEngineOptions(engineType);
|
|
240
|
-
|
|
241
|
-
if (options.requires) {
|
|
242
|
-
tsed.requires.set(engineType, options.requires);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
this.registerEngine(engineType, {
|
|
246
|
-
options,
|
|
247
|
-
render: tsed.getEngine(engineType)
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
getEngines() {
|
|
255
|
-
return [..._classPrivateFieldLooseBase(this, _extensions)[_extensions].entries()].map(([extension, engineType]) => {
|
|
256
|
-
const engine = this.getEngine(this.getExtension(engineType));
|
|
257
|
-
return {
|
|
258
|
-
extension,
|
|
259
|
-
engine
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
registerEngine(engineType, engine) {
|
|
265
|
-
_classPrivateFieldLooseBase(this, _engines)[_engines].set(engineType, engine);
|
|
266
|
-
|
|
267
|
-
return this;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
getEngine(type) {
|
|
271
|
-
return _classPrivateFieldLooseBase(this, _engines)[_engines].get(_classPrivateFieldLooseBase(this, _extensions)[_extensions].get(type) || type);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
getEngineOptions(engineType) {
|
|
275
|
-
return core.getValue(this.engineOptions, engineType, {});
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
async render(viewPath, options = {}) {
|
|
279
|
-
const {
|
|
280
|
-
path,
|
|
281
|
-
extension
|
|
282
|
-
} = _classPrivateFieldLooseBase(this, _cachePaths)[_cachePaths].get(viewPath) || _classPrivateFieldLooseBase(this, _cachePaths)[_cachePaths].set(viewPath, this.resolve(viewPath)).get(viewPath);
|
|
283
|
-
|
|
284
|
-
const engine = this.getEngine(extension);
|
|
285
|
-
|
|
286
|
-
if (!engine) {
|
|
287
|
-
throw new Error(`Engine not found to render the following "${viewPath}"`);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return engine.render(path, Object.assign({
|
|
291
|
-
cache: this.cache || this.env === core.Env.PROD
|
|
292
|
-
}, engine.options, options));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
getExtension(viewPath) {
|
|
296
|
-
return (path.extname(viewPath) || this.viewEngine).replace(/\./, "");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
resolve(viewPath) {
|
|
300
|
-
const extension = this.getExtension(viewPath);
|
|
301
|
-
viewPath = viewPath.replace(path.extname(viewPath), "") + "." + extension;
|
|
302
|
-
const path$1 = [viewPath, path.resolve(path.join(this.root, viewPath)), path.resolve(path.join(process.cwd(), "views", viewPath)), path.resolve(path.join(process.cwd(), "public", viewPath))].find(file => Fs__default['default'].existsSync(file)) || viewPath;
|
|
303
|
-
return {
|
|
304
|
-
path: path$1,
|
|
305
|
-
extension
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
tslib.__decorate([di.Constant("env"), tslib.__metadata("design:type", String)], exports.PlatformViews.prototype, "env", void 0);
|
|
312
|
-
|
|
313
|
-
tslib.__decorate([di.Constant("views.root", `${process.cwd()}/views`), tslib.__metadata("design:type", String)], exports.PlatformViews.prototype, "root", void 0);
|
|
314
|
-
|
|
315
|
-
tslib.__decorate([di.Constant("views.cache"), tslib.__metadata("design:type", Boolean)], exports.PlatformViews.prototype, "cache", void 0);
|
|
316
|
-
|
|
317
|
-
tslib.__decorate([di.Constant("views.disabled", false), tslib.__metadata("design:type", String)], exports.PlatformViews.prototype, "disabled", void 0);
|
|
318
|
-
|
|
319
|
-
tslib.__decorate([di.Constant("views.viewEngine", "ejs"), tslib.__metadata("design:type", String)], exports.PlatformViews.prototype, "viewEngine", void 0);
|
|
320
|
-
|
|
321
|
-
tslib.__decorate([di.Constant("views.extensions", {}), tslib.__metadata("design:type", Object)], exports.PlatformViews.prototype, "extensionsOptions", void 0);
|
|
322
|
-
|
|
323
|
-
tslib.__decorate([di.Constant("views.options", {}), tslib.__metadata("design:type", Object)], exports.PlatformViews.prototype, "engineOptions", void 0);
|
|
324
|
-
|
|
325
|
-
exports.PlatformViews = tslib.__decorate([di.Module({
|
|
326
|
-
views: {
|
|
327
|
-
exists: true
|
|
328
|
-
}
|
|
329
|
-
})], exports.PlatformViews);
|
|
330
|
-
|
|
331
|
-
exports.PLATFORM_VIEWS_EXTENSIONS = PLATFORM_VIEWS_EXTENSIONS;
|
|
332
|
-
exports.View = View;
|
|
333
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/decorators/view.ts","../src/domain/PlatformViewsSettings.ts","../src/services/PlatformViews.ts"],"sourcesContent":["import {StoreSet} from \"@tsed/core\";\n\n/**\n * Use a view and sends the rendered HTML string to the client. Optional parameter:\n *\n * * viewOptions, an object whose properties define local variables for the view.\n *\n * The view argument is a string that is the file path of the view file to render.\n * This can be an absolute path, or a path relative to the views setting.\n * If the path does not contain a file extension, then the view engine setting determines the file extension.\n * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())\n * and render it using the loaded module’s __express function.\n *\n * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).\n *\n * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,\n * and as so for security reasons should not contain input from the end-user.\n *\n * @param path Relative path to the view file.\n * @param options Additional options\n * @decorator\n * @operation\n * @response\n */\nexport function View(path: string, options?: Object): MethodDecorator {\n return StoreSet(\"view\", {path, options}) as any;\n}\n","import {BaseContext} from \"@tsed/di\";\n\nexport const PLATFORM_VIEWS_EXTENSIONS = {\n atpl: \"atpl\",\n bracket: \"bracket\",\n dot: \"dot\",\n dust: \"dust\",\n ect: \"ect\",\n ejs: \"ejs\",\n haml: \"haml\",\n \"haml-coffee\": \"haml-coffee\",\n hamlet: \"hamlet\",\n hbs: \"handlebars\",\n handlebars: \"handlebars\",\n hogan: \"hogan\",\n htmling: \"htmling\",\n jazz: \"jazz\",\n jqtpl: \"jqtpl\",\n just: \"just\",\n kernel: \"kernel\",\n liquid: \"liquid\",\n liquor: \"liquor\",\n lodash: \"lodash\",\n mote: \"mote\",\n mustache: \"mustache\",\n nunjucks: \"nunjucks\",\n plates: \"plates\",\n pug: \"pug\",\n qejs: \"qejs\",\n ractive: \"ractive\",\n razor: \"razor\",\n jsx: \"react\",\n slm: \"slm\",\n squirelly: \"squirelly\",\n swig: \"swig\",\n teacup: \"teacup\",\n templayed: \"templayed\",\n toffee: \"toffee\",\n twig: \"twig\",\n underscore: \"underscore\",\n vash: \"vash\",\n velocityjs: \"velocityjs\",\n walrus: \"walrus\",\n whiskers: \"whiskers\"\n};\n\nexport type PlatformViewsExtensionsTypes = Record<string, string>;\n\nexport interface PlatformViewsEngineOptions extends Record<string, unknown> {\n requires?: any;\n}\n\nexport interface PlatformRenderOptions extends Record<string, unknown> {\n $ctx: BaseContext;\n}\n\nexport interface PlatformViewEngine {\n options: PlatformViewsEngineOptions;\n\n render(path: string, options: PlatformRenderOptions): Promise<string>;\n}\n\nexport interface PlatformViewsSettings {\n disabled?: boolean;\n /**\n * Views directory.\n */\n root?: string;\n /**\n * Enable cache. Ts.ED enable cache in PRODUCTION profile by default.\n */\n cache?: boolean;\n /**\n * Provide extensions mapping to match the expected engines.\n */\n extensions?: Partial<PlatformViewsExtensionsTypes>;\n /**\n * Default view engine extension.\n * Allow omitting extension when using View decorator or render method.\n */\n viewEngine?: string;\n /**\n * Options mapping for each engine.\n */\n options?: Record<string, PlatformViewsEngineOptions>;\n}\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n /**\n * Object to configure Views engines with Consolidate. See more on [View engine](/docs/template-engine.md).\n */\n views: PlatformViewsSettings;\n }\n }\n}\n","import {Env, getValue} from \"@tsed/core\";\nimport {Constant, Module} from \"@tsed/di\";\nimport Fs from \"fs\";\nimport {extname, join, resolve} from \"path\";\nimport {\n PLATFORM_VIEWS_EXTENSIONS,\n PlatformViewEngine,\n PlatformViewsEngineOptions,\n PlatformViewsExtensionsTypes\n} from \"../domain/PlatformViewsSettings\";\n\nfunction patchEJS(ejs: any) {\n return {\n compile(str: string, {client, ...options}: any) {\n return (ejs || require(\"ejs\")).compile(str, options);\n }\n };\n}\n\nasync function tryImport(name: string) {\n try {\n return await import(name);\n } catch (er) {\n // istanbul ignore next\n }\n}\n\n/**\n * @platform\n */\n@Module({\n views: {\n exists: true\n }\n})\nexport class PlatformViews {\n @Constant(\"env\")\n env: Env;\n\n @Constant(\"views.root\", `${process.cwd()}/views`)\n readonly root: string;\n\n @Constant(\"views.cache\")\n readonly cache: boolean;\n\n @Constant(\"views.disabled\", false)\n readonly disabled: string;\n\n @Constant(\"views.viewEngine\", \"ejs\")\n readonly viewEngine: string;\n\n @Constant(\"views.extensions\", {})\n protected extensionsOptions: PlatformViewsExtensionsTypes;\n\n @Constant(\"views.options\", {})\n protected engineOptions: Record<string, PlatformViewsEngineOptions>;\n\n #extensions: Map<string, string>;\n #engines = new Map<string, PlatformViewEngine>();\n #cachePaths = new Map<string, {path: string; extension: string}>();\n\n async $onInit() {\n if (!this.disabled) {\n this.#extensions = new Map(\n Object.entries({\n ...PLATFORM_VIEWS_EXTENSIONS,\n ...this.extensionsOptions\n })\n );\n\n await this.loadFromConsolidate();\n await this.loadFromTsedEngines();\n }\n }\n\n /**\n * @deprecated\n */\n async loadFromConsolidate() {\n const cons = await tryImport(\"consolidate\");\n if (cons) {\n cons.requires.ejs = patchEJS(cons.requires.ejs);\n\n this.#extensions.forEach((engineType) => {\n if ((cons as any)[engineType]) {\n const options = this.getEngineOptions(engineType);\n\n if (options.requires) {\n (cons.requires as any)[engineType] = options.requires;\n }\n\n this.registerEngine(engineType, {\n options,\n render: (cons as any)[engineType]\n });\n }\n });\n }\n }\n\n async loadFromTsedEngines() {\n const tsed = await tryImport(\"@tsed/engines\");\n\n if (tsed) {\n tsed.requires.set(\"ejs\", patchEJS(tsed.requires.get(\"ejs\")));\n\n this.#extensions.forEach((engineType) => {\n if (tsed.engines.has(engineType)) {\n const options = this.getEngineOptions(engineType);\n\n if (options.requires) {\n tsed.requires.set(engineType, options.requires);\n }\n\n this.registerEngine(engineType, {\n options,\n render: tsed.getEngine(engineType)\n });\n }\n });\n }\n }\n\n getEngines() {\n return [...this.#extensions.entries()].map(([extension, engineType]) => {\n const engine = this.getEngine(this.getExtension(engineType))!;\n\n return {\n extension,\n engine\n };\n });\n }\n\n registerEngine(engineType: string, engine: PlatformViewEngine) {\n this.#engines.set(engineType, engine);\n\n return this;\n }\n\n getEngine(type: string) {\n return this.#engines.get(this.#extensions.get(type) || type);\n }\n\n getEngineOptions(engineType: string): PlatformViewsEngineOptions {\n return getValue(this.engineOptions, engineType, {});\n }\n\n async render(viewPath: string, options: any = {}): Promise<string> {\n const {path, extension} = this.#cachePaths.get(viewPath) || this.#cachePaths.set(viewPath, this.resolve(viewPath)).get(viewPath)!;\n const engine = this.getEngine(extension);\n\n if (!engine) {\n throw new Error(`Engine not found to render the following \"${viewPath}\"`);\n }\n\n return engine.render(path, Object.assign({cache: this.cache || this.env === Env.PROD}, engine.options, options));\n }\n\n protected getExtension(viewPath: string) {\n return (extname(viewPath) || this.viewEngine).replace(/\\./, \"\");\n }\n\n protected resolve(viewPath: string) {\n const extension = this.getExtension(viewPath);\n\n viewPath = viewPath.replace(extname(viewPath), \"\") + \".\" + extension;\n\n const path =\n [\n viewPath,\n resolve(join(this.root, viewPath)),\n resolve(join(process.cwd(), \"views\", viewPath)),\n resolve(join(process.cwd(), \"public\", viewPath))\n ].find((file) => Fs.existsSync(file)) || viewPath;\n\n return {\n path,\n extension\n };\n }\n}\n"],"names":["View","path","options","StoreSet","PLATFORM_VIEWS_EXTENSIONS","atpl","bracket","dot","dust","ect","ejs","haml","hamlet","hbs","handlebars","hogan","htmling","jazz","jqtpl","just","kernel","liquid","liquor","lodash","mote","mustache","nunjucks","plates","pug","qejs","ractive","razor","jsx","slm","squirelly","swig","teacup","templayed","toffee","twig","underscore","vash","velocityjs","walrus","whiskers","patchEJS","compile","str","require","tryImport","name","er","PlatformViews","constructor","Map","$onInit","disabled","Object","entries","extensionsOptions","loadFromConsolidate","loadFromTsedEngines","cons","requires","forEach","engineType","getEngineOptions","registerEngine","render","tsed","set","get","engines","has","getEngine","getEngines","map","extension","engine","getExtension","type","getValue","engineOptions","viewPath","resolve","Error","assign","cache","env","Env","PROD","extname","viewEngine","replace","join","root","process","cwd","find","file","Fs","existsSync","__decorate","Constant","Module","views","exists"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;SAsBgBA,KAAKC,MAAcC;AACjC,SAAOC,aAAQ,CAAC,MAAD,EAAS;AAACF,IAAAA,IAAD;AAAOC,IAAAA;AAAP,GAAT,CAAf;AACD;;MCxBYE,yBAAyB,GAAG;AACvCC,EAAAA,IAAI,EAAE,MADiC;AAEvCC,EAAAA,OAAO,EAAE,SAF8B;AAGvCC,EAAAA,GAAG,EAAE,KAHkC;AAIvCC,EAAAA,IAAI,EAAE,MAJiC;AAKvCC,EAAAA,GAAG,EAAE,KALkC;AAMvCC,EAAAA,GAAG,EAAE,KANkC;AAOvCC,EAAAA,IAAI,EAAE,MAPiC;AAQvC,iBAAe,aARwB;AASvCC,EAAAA,MAAM,EAAE,QAT+B;AAUvCC,EAAAA,GAAG,EAAE,YAVkC;AAWvCC,EAAAA,UAAU,EAAE,YAX2B;AAYvCC,EAAAA,KAAK,EAAE,OAZgC;AAavCC,EAAAA,OAAO,EAAE,SAb8B;AAcvCC,EAAAA,IAAI,EAAE,MAdiC;AAevCC,EAAAA,KAAK,EAAE,OAfgC;AAgBvCC,EAAAA,IAAI,EAAE,MAhBiC;AAiBvCC,EAAAA,MAAM,EAAE,QAjB+B;AAkBvCC,EAAAA,MAAM,EAAE,QAlB+B;AAmBvCC,EAAAA,MAAM,EAAE,QAnB+B;AAoBvCC,EAAAA,MAAM,EAAE,QApB+B;AAqBvCC,EAAAA,IAAI,EAAE,MArBiC;AAsBvCC,EAAAA,QAAQ,EAAE,UAtB6B;AAuBvCC,EAAAA,QAAQ,EAAE,UAvB6B;AAwBvCC,EAAAA,MAAM,EAAE,QAxB+B;AAyBvCC,EAAAA,GAAG,EAAE,KAzBkC;AA0BvCC,EAAAA,IAAI,EAAE,MA1BiC;AA2BvCC,EAAAA,OAAO,EAAE,SA3B8B;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