@tsed/platform-views 8.0.0-alpha.5 → 8.0.0-alpha.6

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.
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  import { BaseContext } from "@tsed/di";
3
3
  import { Writable } from "stream";
4
4
  export declare const PLATFORM_VIEWS_EXTENSIONS: {
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@tsed/platform-views",
3
3
  "description": "Views module for Ts.ED Framework",
4
- "type": "commonjs",
5
- "version": "8.0.0-alpha.5",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.6",
6
6
  "source": "./src/index.ts",
7
- "main": "./lib/cjs/index.js",
7
+ "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./lib/types/index.d.ts",
13
13
  "import": "./lib/esm/index.js",
14
- "require": "./lib/cjs/index.js",
15
14
  "default": "./lib/cjs/index.js"
16
15
  }
17
16
  },
@@ -23,29 +22,29 @@
23
22
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
24
23
  },
25
24
  "dependencies": {
26
- "@tsed/engines": "8.0.0-alpha.5",
25
+ "@tsed/engines": "8.0.0-alpha.6",
27
26
  "ejs": "^3.1.9",
28
27
  "tslib": "2.6.1"
29
28
  },
30
29
  "devDependencies": {
31
- "@tsed/barrels": "8.0.0-alpha.5",
32
- "@tsed/core": "8.0.0-alpha.5",
33
- "@tsed/di": "8.0.0-alpha.5",
34
- "@tsed/engines": "8.0.0-alpha.5",
35
- "@tsed/exceptions": "8.0.0-alpha.5",
36
- "@tsed/schema": "8.0.0-alpha.5",
37
- "@tsed/typescript": "8.0.0-alpha.5",
30
+ "@tsed/barrels": "8.0.0-alpha.6",
31
+ "@tsed/core": "8.0.0-alpha.6",
32
+ "@tsed/di": "8.0.0-alpha.6",
33
+ "@tsed/engines": "8.0.0-alpha.6",
34
+ "@tsed/exceptions": "8.0.0-alpha.6",
35
+ "@tsed/schema": "8.0.0-alpha.6",
36
+ "@tsed/typescript": "8.0.0-alpha.6",
38
37
  "@types/ejs": "3.1.5",
39
38
  "eslint": "^8.57.0",
40
39
  "typescript": "4.9.5",
41
40
  "vitest": "2.0.4"
42
41
  },
43
42
  "peerDependencies": {
44
- "@tsed/core": "8.0.0-alpha.5",
45
- "@tsed/di": "8.0.0-alpha.5",
46
- "@tsed/engines": "8.0.0-alpha.5",
47
- "@tsed/exceptions": "8.0.0-alpha.5",
48
- "@tsed/schema": "8.0.0-alpha.5"
43
+ "@tsed/core": "8.0.0-alpha.6",
44
+ "@tsed/di": "8.0.0-alpha.6",
45
+ "@tsed/engines": "8.0.0-alpha.6",
46
+ "@tsed/exceptions": "8.0.0-alpha.6",
47
+ "@tsed/schema": "8.0.0-alpha.6"
49
48
  },
50
49
  "peerDependenciesMeta": {
51
50
  "@tsed/core": {
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.View = void 0;
4
- var schema_1 = require("@tsed/schema");
5
- Object.defineProperty(exports, "View", { enumerable: true, get: function () { return schema_1.View; } });
6
- //# sourceMappingURL=view.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/decorators/view.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAA1B,8FAAA,IAAI,OAAA"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PLATFORM_VIEWS_EXTENSIONS = void 0;
4
- exports.PLATFORM_VIEWS_EXTENSIONS = {
5
- atpl: "atpl",
6
- bracket: "bracket",
7
- dot: "dot",
8
- dust: "dust",
9
- ect: "ect",
10
- ejs: "ejs",
11
- haml: "haml",
12
- "haml-coffee": "haml-coffee",
13
- hamlet: "hamlet",
14
- hbs: "handlebars",
15
- handlebars: "handlebars",
16
- hogan: "hogan",
17
- htmling: "htmling",
18
- jazz: "jazz",
19
- jqtpl: "jqtpl",
20
- just: "just",
21
- kernel: "kernel",
22
- liquid: "liquid",
23
- liquor: "liquor",
24
- lodash: "lodash",
25
- mote: "mote",
26
- mustache: "mustache",
27
- nunjucks: "nunjucks",
28
- plates: "plates",
29
- pug: "pug",
30
- qejs: "qejs",
31
- ractive: "ractive",
32
- razor: "razor",
33
- jsx: "react",
34
- slm: "slm",
35
- squirelly: "squirelly",
36
- swig: "swig",
37
- teacup: "teacup",
38
- templayed: "templayed",
39
- twig: "twig",
40
- underscore: "underscore",
41
- vash: "vash",
42
- velocityjs: "velocityjs",
43
- walrus: "walrus",
44
- whiskers: "whiskers"
45
- };
46
- //# sourceMappingURL=PlatformViewsSettings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformViewsSettings.js","sourceRoot":"","sources":["../../../src/domain/PlatformViewsSettings.ts"],"names":[],"mappings":";;;AAGa,QAAA,yBAAyB,GAAG;IACvC,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,aAAa;IAC5B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,YAAY;IACjB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACrB,CAAC"}
package/lib/cjs/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @file Automatically generated by @tsed/barrels.
6
- */
7
- tslib_1.__exportStar(require("./decorators/view.js"), exports);
8
- tslib_1.__exportStar(require("./domain/PlatformViewsSettings.js"), exports);
9
- tslib_1.__exportStar(require("./services/PlatformViews.js"), exports);
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAAqC;AACrC,4EAAkD;AAClD,sEAA4C"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformViews = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@tsed/core");
6
- const di_1 = require("@tsed/di");
7
- const engines_1 = require("@tsed/engines");
8
- const fs_1 = tslib_1.__importDefault(require("fs"));
9
- const path_1 = require("path");
10
- const PlatformViewsSettings_js_1 = require("../domain/PlatformViewsSettings.js");
11
- async function patchEJS(ejs) {
12
- if (!ejs) {
13
- const mod = await Promise.resolve().then(() => tslib_1.__importStar(require("ejs")));
14
- ejs = mod.default;
15
- }
16
- return {
17
- compile(str, { client, ...options }) {
18
- return ejs.compile(str, options);
19
- }
20
- };
21
- }
22
- /**
23
- * @platform
24
- */
25
- let PlatformViews = class PlatformViews {
26
- constructor() {
27
- this.#engines = new Map();
28
- this.#cachePaths = new Map();
29
- }
30
- #extensions;
31
- #engines;
32
- #cachePaths;
33
- async $onInit() {
34
- if (!this.disabled) {
35
- this.#extensions = new Map(Object.entries({
36
- ...PlatformViewsSettings_js_1.PLATFORM_VIEWS_EXTENSIONS,
37
- ...this.extensionsOptions
38
- }));
39
- await this.loadEngines();
40
- }
41
- }
42
- async loadEngines() {
43
- engines_1.requires.set("ejs", await patchEJS(engines_1.requires.get("ejs")));
44
- this.#extensions.forEach((engineType) => {
45
- if (engines_1.engines.has(engineType)) {
46
- const options = this.getEngineOptions(engineType);
47
- if (options.requires) {
48
- engines_1.requires.set(engineType, options.requires);
49
- }
50
- this.registerEngine(engineType, {
51
- options,
52
- render: (0, engines_1.getEngine)(engineType)
53
- });
54
- }
55
- });
56
- }
57
- getEngines() {
58
- return [...this.#extensions.entries()].map(([extension, engineType]) => {
59
- const engine = this.getEngine(this.getExtension(engineType));
60
- return {
61
- extension,
62
- engine
63
- };
64
- });
65
- }
66
- registerEngine(engineType, engine) {
67
- this.#engines.set(engineType, engine);
68
- return this;
69
- }
70
- getEngine(type) {
71
- return this.#engines.get(this.#extensions.get(type) || type);
72
- }
73
- getEngineOptions(engineType) {
74
- return (0, core_1.getValue)(this.engineOptions, engineType, {});
75
- }
76
- async render(viewPath, options = {}) {
77
- const { $ctx } = options;
78
- options = await this.injector.alterAsync("$alterRenderOptions", options, $ctx);
79
- const { path, extension } = this.#cachePaths.get(viewPath) || this.#cachePaths.set(viewPath, this.resolve(viewPath)).get(viewPath);
80
- const engine = this.getEngine(extension);
81
- if (!engine) {
82
- throw new Error(`Engine not found to render the following "${viewPath}"`);
83
- }
84
- const finalOpts = Object.assign({ cache: this.cache || this.env === core_1.Env.PROD }, engine.options, options, { $ctx });
85
- return engine.render(path, finalOpts);
86
- }
87
- getExtension(viewPath) {
88
- return ((0, path_1.extname)(viewPath) || this.viewEngine).replace(/\./, "");
89
- }
90
- resolve(viewPath) {
91
- const extension = this.getExtension(viewPath);
92
- viewPath = viewPath.replace((0, path_1.extname)(viewPath), "") + "." + extension;
93
- const path = [
94
- viewPath,
95
- (0, path_1.resolve)((0, path_1.join)(this.root, viewPath)),
96
- (0, path_1.resolve)((0, path_1.join)(process.cwd(), "views", viewPath)),
97
- (0, path_1.resolve)((0, path_1.join)(process.cwd(), "public", viewPath))
98
- ].find((file) => fs_1.default.existsSync(file)) || viewPath;
99
- return {
100
- path,
101
- extension
102
- };
103
- }
104
- };
105
- tslib_1.__decorate([
106
- (0, di_1.Constant)("env"),
107
- tslib_1.__metadata("design:type", String)
108
- ], PlatformViews.prototype, "env", void 0);
109
- tslib_1.__decorate([
110
- (0, di_1.Constant)("views.root", `${process.cwd()}/views`),
111
- tslib_1.__metadata("design:type", String)
112
- ], PlatformViews.prototype, "root", void 0);
113
- tslib_1.__decorate([
114
- (0, di_1.Constant)("views.cache"),
115
- tslib_1.__metadata("design:type", Boolean)
116
- ], PlatformViews.prototype, "cache", void 0);
117
- tslib_1.__decorate([
118
- (0, di_1.Constant)("views.disabled", false),
119
- tslib_1.__metadata("design:type", String)
120
- ], PlatformViews.prototype, "disabled", void 0);
121
- tslib_1.__decorate([
122
- (0, di_1.Constant)("views.viewEngine", "ejs"),
123
- tslib_1.__metadata("design:type", String)
124
- ], PlatformViews.prototype, "viewEngine", void 0);
125
- tslib_1.__decorate([
126
- (0, di_1.Constant)("views.extensions", {}),
127
- tslib_1.__metadata("design:type", Object)
128
- ], PlatformViews.prototype, "extensionsOptions", void 0);
129
- tslib_1.__decorate([
130
- (0, di_1.Constant)("views.options", {}),
131
- tslib_1.__metadata("design:type", Object)
132
- ], PlatformViews.prototype, "engineOptions", void 0);
133
- tslib_1.__decorate([
134
- (0, di_1.Inject)(),
135
- tslib_1.__metadata("design:type", di_1.InjectorService)
136
- ], PlatformViews.prototype, "injector", void 0);
137
- PlatformViews = tslib_1.__decorate([
138
- (0, di_1.Module)({
139
- views: {
140
- exists: true
141
- }
142
- })
143
- ], PlatformViews);
144
- exports.PlatformViews = PlatformViews;
145
- //# sourceMappingURL=PlatformViews.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformViews.js","sourceRoot":"","sources":["../../../src/services/PlatformViews.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,iCAAmE;AACnE,2CAA2D;AAC3D,oDAAoB;AACpB,+BAA4C;AAC5C,iFAM4C;AAE5C,KAAK,UAAU,QAAQ,CAAC,GAAQ;IAC9B,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,GAAG,GAAG,gEAAa,KAAK,GAAC,CAAC;QAChC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;KACnB;IAED,OAAO;QACL,OAAO,CAAC,GAAW,EAAE,EAAC,MAAM,EAAE,GAAG,OAAO,EAAM;YAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AAMI,IAAM,aAAa,GAAnB,MAAM,aAAa;IAAnB;QA0BL,aAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;QACjD,gBAAW,GAAG,IAAI,GAAG,EAA6C,CAAC;IAiGrE,CAAC;IAnGC,WAAW,CAAsB;IACjC,QAAQ,CAAyC;IACjD,WAAW,CAAwD;IAEnE,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,CACxB,MAAM,CAAC,OAAO,CAAC;gBACb,GAAG,oDAAyB;gBAC5B,GAAG,IAAI,CAAC,iBAAiB;aAC1B,CAAC,CACH,CAAC;YAEF,MAAM,IAAI,CAAC,WAAW,EAAE,CA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e;+CAAC;AAvBzB,aAAa;IALzB,IAAA,WAAM,EAAC;QACN,KAAK,EAAE;YACL,MAAM,EAAE,IAAI;SACb;KACF,CAAC;GACW,aAAa,CA4HzB;AA5HY,sCAAa"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1 +0,0 @@
1
- export { View } from "@tsed/schema";
@@ -1,93 +0,0 @@
1
- /// <reference types="node" />
2
- import { BaseContext } from "@tsed/di";
3
- import { Writable } from "stream";
4
- export declare const PLATFORM_VIEWS_EXTENSIONS: {
5
- atpl: string;
6
- bracket: string;
7
- dot: string;
8
- dust: string;
9
- ect: string;
10
- ejs: string;
11
- haml: string;
12
- "haml-coffee": string;
13
- hamlet: string;
14
- hbs: string;
15
- handlebars: string;
16
- hogan: string;
17
- htmling: string;
18
- jazz: string;
19
- jqtpl: string;
20
- just: string;
21
- kernel: string;
22
- liquid: string;
23
- liquor: string;
24
- lodash: string;
25
- mote: string;
26
- mustache: string;
27
- nunjucks: string;
28
- plates: string;
29
- pug: string;
30
- qejs: string;
31
- ractive: string;
32
- razor: string;
33
- jsx: string;
34
- slm: string;
35
- squirelly: string;
36
- swig: string;
37
- teacup: string;
38
- templayed: string;
39
- twig: string;
40
- underscore: string;
41
- vash: string;
42
- velocityjs: string;
43
- walrus: string;
44
- whiskers: string;
45
- };
46
- export type PlatformViewsExtensionsTypes = Record<string, string>;
47
- export interface PlatformViewsEngineOptions extends Record<string, unknown> {
48
- requires?: any;
49
- }
50
- export interface PlatformRenderOptions extends Record<string, unknown> {
51
- $ctx: BaseContext;
52
- }
53
- export interface PlatformViewWritableStream {
54
- pipe(stream: Writable): void;
55
- }
56
- export interface PlatformViewEngine {
57
- options: PlatformViewsEngineOptions;
58
- render(path: string, options: PlatformRenderOptions): Promise<string | PlatformViewWritableStream>;
59
- }
60
- export interface PlatformViewsSettings {
61
- disabled?: boolean;
62
- /**
63
- * Views directory.
64
- */
65
- root?: string;
66
- /**
67
- * Enable cache. Ts.ED enable cache in PRODUCTION profile by default.
68
- */
69
- cache?: boolean;
70
- /**
71
- * Provide extensions mapping to match the expected engines.
72
- */
73
- extensions?: Partial<PlatformViewsExtensionsTypes>;
74
- /**
75
- * Default view engine extension.
76
- * Allow omitting extension when using View decorator or render method.
77
- */
78
- viewEngine?: string;
79
- /**
80
- * Options mapping for each engine.
81
- */
82
- options?: Record<string, PlatformViewsEngineOptions>;
83
- }
84
- declare global {
85
- namespace TsED {
86
- interface Configuration {
87
- /**
88
- * Object to configure Views engines with Consolidate. See more on [View engine](/docs/template-engine.md).
89
- */
90
- views: PlatformViewsSettings;
91
- }
92
- }
93
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./decorators/view.js";
5
- export * from "./domain/PlatformViewsSettings.js";
6
- export * from "./services/PlatformViews.js";
@@ -1,32 +0,0 @@
1
- import { Env } from "@tsed/core";
2
- import { InjectorService } from "@tsed/di";
3
- import { PlatformViewEngine, PlatformViewsEngineOptions, PlatformViewsExtensionsTypes, PlatformViewWritableStream } from "../domain/PlatformViewsSettings.js";
4
- /**
5
- * @platform
6
- */
7
- export declare class PlatformViews {
8
- #private;
9
- env: Env;
10
- readonly root: string;
11
- readonly cache: boolean;
12
- readonly disabled: string;
13
- readonly viewEngine: string;
14
- protected extensionsOptions: PlatformViewsExtensionsTypes;
15
- protected engineOptions: Record<string, PlatformViewsEngineOptions>;
16
- protected injector: InjectorService;
17
- $onInit(): Promise<void>;
18
- loadEngines(): Promise<void>;
19
- getEngines(): {
20
- extension: string;
21
- engine: PlatformViewEngine;
22
- }[];
23
- registerEngine(engineType: string, engine: PlatformViewEngine): this;
24
- getEngine(type: string): PlatformViewEngine | undefined;
25
- getEngineOptions(engineType: string): PlatformViewsEngineOptions;
26
- render(viewPath: string, options?: any): Promise<string | PlatformViewWritableStream>;
27
- protected getExtension(viewPath: string): string;
28
- protected resolve(viewPath: string): {
29
- path: string;
30
- extension: string;
31
- };
32
- }