@spinajs/templates 2.0.38

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 ADDED
@@ -0,0 +1,11 @@
1
+ # `email`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const email = require('email');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,12 @@
1
+ import { CliCommand } from '@spinajs/cli';
2
+ import { ILog } from '@spinajs/log';
3
+ interface RenderOptions {
4
+ file?: string;
5
+ model?: string;
6
+ lang?: string;
7
+ }
8
+ export declare class RenderTemplateCommand extends CliCommand {
9
+ protected Log: ILog;
10
+ execute(template: string, options: RenderOptions): Promise<void>;
11
+ }
12
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.RenderTemplateCommand = void 0;
36
+ const index_1 = require("./../index");
37
+ const cli_1 = require("@spinajs/cli");
38
+ const di_1 = require("@spinajs/di");
39
+ const path = __importStar(require("path"));
40
+ const fs = __importStar(require("fs"));
41
+ const log_1 = require("@spinajs/log");
42
+ let RenderTemplateCommand = class RenderTemplateCommand extends cli_1.CliCommand {
43
+ async execute(template, options) {
44
+ this.Log.trace(`Rendering ${template}, options: ${JSON.stringify(options)}`);
45
+ try {
46
+ const templates = await di_1.DI.resolve(index_1.Templates);
47
+ let model = {};
48
+ if (options.model && fs.existsSync(options.model)) {
49
+ this.Log.trace(`Found model file at ${options.model}, trying to load model data ... `);
50
+ const mText = fs.readFileSync(options.model, { encoding: 'utf-8' });
51
+ model = JSON.parse(mText);
52
+ }
53
+ if (options && options.file) {
54
+ this.Log.trace(`Rendering template to file ${options.file} ...`);
55
+ const dir = path.dirname(options.file);
56
+ if (!fs.existsSync(dir)) {
57
+ this.Log.trace(`Directory ${dir} not exits, creating ...`);
58
+ fs.mkdirSync(dir, { recursive: true });
59
+ }
60
+ await templates.renderToFile(template, model, options.file, options.lang);
61
+ this.Log.success(`Rendering template ${template} to file ${options.file} succeded !`);
62
+ return;
63
+ }
64
+ const result = await templates.render(template, model, options.lang);
65
+ this.Log.success(`Rendering template ${template} succeded !`);
66
+ // print out to console in raw format
67
+ console.log(result);
68
+ }
69
+ catch (err) {
70
+ this.Log.error(`Cannot render template ${template}, reason: ${err.message}, stack: ${err.stack}`);
71
+ }
72
+ }
73
+ };
74
+ __decorate([
75
+ (0, log_1.Logger)('templates'),
76
+ __metadata("design:type", Object)
77
+ ], RenderTemplateCommand.prototype, "Log", void 0);
78
+ RenderTemplateCommand = __decorate([
79
+ (0, cli_1.Command)('template-render', 'Renders template, usefull for template testing'),
80
+ (0, cli_1.Argument)('template', 'template path, must be in one of direcotory provided in configs'),
81
+ (0, cli_1.Option)('-f, --file [file]', false, 'path for file, where parsing result will be saved'),
82
+ (0, cli_1.Option)('-m, --model [model]', false, 'path to optional model data, passed to template, in json format'),
83
+ (0, cli_1.Option)('-l, --lang [lang]', false, 'optional language. Language data must be in directories configured in intl module. If none provided, default language is used')
84
+ ], RenderTemplateCommand);
85
+ exports.RenderTemplateCommand = RenderTemplateCommand;
86
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/cli/render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAuC;AACvC,sCAAqE;AACrE,oCAAiC;AACjC,2CAA6B;AAC7B,uCAAyB;AACzB,sCAA4C;AAa5C,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,gBAAU;IAI5C,KAAK,CAAC,OAAO,CAAC,QAAgB,EAAE,OAAsB;QAC3D,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,QAAQ,cAAc,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE7E,IAAI;YACF,MAAM,SAAS,GAAG,MAAM,OAAE,CAAC,OAAO,CAAC,iBAAS,CAAC,CAAC;YAC9C,IAAI,KAAK,GAAG,EAAE,CAAC;YAEf,IAAI,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACjD,IAAI,CAA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I,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,QAAQ,aAAa,GAAG,CAAC,OAAO,YAAY,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;SACnG;IACH,CAAC;CACF,CAAA;AA1CC;IADC,IAAA,YAAM,EAAC,WAAW,CAAC;;kDACA;AAFT,qBAAqB;IALjC,IAAA,aAAO,EAAC,iBAAiB,EAAE,gDAAgD,CAAC;IAC5E,IAAA,cAAQ,EAAC,UAAU,EAAE,iEAAiE,CAAC;IACvF,IAAA,YAAM,EAAC,mBAAmB,EAAE,KAAK,EAAE,mDAAmD,CAAC;IACvF,IAAA,YAAM,EAAC,qBAAqB,EAAE,KAAK,EAAE,iEAAiE,CAAC;IACvG,IAAA,YAAM,EAAC,mBAAmB,EAAE,KAAK,EAAE,+HAA+H,CAAC;GACvJ,qBAAqB,CA4CjC;AA5CY,sDAAqB"}
@@ -0,0 +1,9 @@
1
+ declare const templates: {
2
+ system: {
3
+ dirs: {
4
+ templates: string[];
5
+ cli: string[];
6
+ };
7
+ };
8
+ };
9
+ export default templates;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ function dir(path) {
5
+ return (0, path_1.resolve)((0, path_1.normalize)((0, path_1.join)(__dirname, path)));
6
+ }
7
+ const templates = {
8
+ system: {
9
+ dirs: {
10
+ templates: [dir('./../templates')],
11
+ cli: [dir('./../cli')],
12
+ },
13
+ },
14
+ };
15
+ exports.default = templates;
16
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/config/templates.ts"],"names":[],"mappings":";;AAAA,+BAAgD;AAEhD,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,IAAA,cAAO,EAAC,IAAA,gBAAS,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,SAAS,GAAG;IAChB,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,SAAS,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAClC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SACvB;KACF;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { AsyncModule } from '@spinajs/di';
2
+ import { Log } from '@spinajs/log';
3
+ import { TemplateRenderer } from './interfaces';
4
+ export * from './interfaces';
5
+ /**
6
+ * Inject INTL module for language support. We does nothing but to initialize module for use in templates.
7
+ */
8
+ export declare class Templates extends AsyncModule {
9
+ protected Log: Log;
10
+ protected Renderers: Map<string, TemplateRenderer>;
11
+ render(templatePath: string, model: unknown, language?: string): Promise<string>;
12
+ renderToFile(templatePath: string, model: unknown, filePath: string, language?: string): Promise<void>;
13
+ }
package/lib/index.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ };
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ var __metadata = (this && this.__metadata) || function (k, v) {
23
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Templates = void 0;
27
+ const exceptions_1 = require("@spinajs/exceptions");
28
+ const di_1 = require("@spinajs/di");
29
+ const log_1 = require("@spinajs/log");
30
+ const interfaces_1 = require("./interfaces");
31
+ const path_1 = require("path");
32
+ const intl_1 = require("@spinajs/intl");
33
+ __exportStar(require("./interfaces"), exports);
34
+ /**
35
+ * Inject INTL module for language support. We does nothing but to initialize module for use in templates.
36
+ */
37
+ let Templates = class Templates extends di_1.AsyncModule {
38
+ async render(templatePath, model, language) {
39
+ const extension = (0, path_1.extname)(templatePath);
40
+ if (!this.Renderers.has(extension)) {
41
+ throw new exceptions_1.InvalidOperation(`No renderer for file ${templatePath} with extension ${extension}`);
42
+ }
43
+ return await this.Renderers.get(extension).render(templatePath, model, language);
44
+ }
45
+ async renderToFile(templatePath, model, filePath, language) {
46
+ const extension = (0, path_1.extname)(templatePath);
47
+ if (!this.Renderers.has(extension)) {
48
+ throw new exceptions_1.InvalidOperation(`No renderer for file ${templatePath} with extension ${extension}`);
49
+ }
50
+ return await this.Renderers.get(extension).renderToFile(templatePath, model, filePath, language);
51
+ }
52
+ };
53
+ __decorate([
54
+ (0, log_1.Logger)('templates'),
55
+ __metadata("design:type", log_1.Log)
56
+ ], Templates.prototype, "Log", void 0);
57
+ __decorate([
58
+ (0, di_1.Autoinject)(interfaces_1.TemplateRenderer, (x) => x.Extension),
59
+ __metadata("design:type", Map)
60
+ ], Templates.prototype, "Renderers", void 0);
61
+ Templates = __decorate([
62
+ (0, di_1.Inject)(intl_1.Intl)
63
+ ], Templates);
64
+ exports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C;8BACL,SAAG;sCAAC;AAGnB;IADC,IAAA,eAAU,EAAC,6BAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;8BAC5B,GAAG;4CAA2B;AALxC,SAAS;IADrB,IAAA,WAAM,EAAC,WAAI,CAAC;GACA,SAAS,CAwBrB;AAxBY,8BAAS"}
@@ -0,0 +1,13 @@
1
+ import { AsyncModule } from '@spinajs/di';
2
+ import { Log } from '@spinajs/log';
3
+ export declare abstract class TemplateRenderer extends AsyncModule {
4
+ protected Log: Log;
5
+ protected TemplatePaths: string[];
6
+ protected TemplateFiles: Map<string, string[]>;
7
+ abstract get Type(): string;
8
+ abstract get Extension(): string;
9
+ abstract render(templatePath: string, model: unknown, language?: string): Promise<string>;
10
+ abstract renderToFile(templatePath: string, model: unknown, filePath: string, language?: string): Promise<void>;
11
+ protected abstract compile(templateName: string, path: string): Promise<void>;
12
+ resolveAsync(): Promise<void>;
13
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TemplateRenderer = void 0;
13
+ const configuration_1 = require("@spinajs/configuration");
14
+ const di_1 = require("@spinajs/di");
15
+ const log_1 = require("@spinajs/log");
16
+ const path_1 = require("path");
17
+ const glob_1 = require("glob");
18
+ class TemplateRenderer extends di_1.AsyncModule {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.TemplateFiles = new Map();
22
+ }
23
+ async resolveAsync() {
24
+ for (const path of this.TemplatePaths) {
25
+ const files = glob_1.glob.sync((0, path_1.join)(path, `/**/*${this.Extension}`));
26
+ for (const file of files) {
27
+ const templateName = file.substring(path.length + 1, file.length);
28
+ if (this.TemplateFiles.has(templateName)) {
29
+ this.Log.trace(`Template ${templateName} is overriden by ${file}`);
30
+ this.TemplateFiles.get(templateName).push(file);
31
+ }
32
+ else {
33
+ this.Log.trace(`Found template ${templateName} file at path ${file}`);
34
+ this.TemplateFiles.set(templateName, [file]);
35
+ }
36
+ }
37
+ }
38
+ for (const [templateName, path] of this.TemplateFiles) {
39
+ if (path.length === 0) {
40
+ this.Log.warn(`Template ${templateName} don't have any files`);
41
+ continue;
42
+ }
43
+ this.Log.trace(`Compiling template ${templateName}, at path ${path[path.length - 1]}`);
44
+ // compile only last template ( newest )
45
+ // templates can be overriden by other modules / libs
46
+ // or app
47
+ try {
48
+ await this.compile(templateName, path[path.length - 1]);
49
+ }
50
+ catch (err) {
51
+ this.Log.error(`Cannot compile template ${templateName} with file ${path[path.length - 1]}, reason: ${JSON.stringify(err)}`);
52
+ continue;
53
+ }
54
+ this.Log.trace(`Compiling template ${templateName}, at path ${path[path.length - 1]} finished`);
55
+ }
56
+ }
57
+ }
58
+ __decorate([
59
+ (0, log_1.Logger)('renderer'),
60
+ __metadata("design:type", log_1.Log)
61
+ ], TemplateRenderer.prototype, "Log", void 0);
62
+ __decorate([
63
+ (0, configuration_1.Config)('system.dirs.templates', []),
64
+ __metadata("design:type", Array)
65
+ ], TemplateRenderer.prototype, "TemplatePaths", void 0);
66
+ exports.TemplateRenderer = TemplateRenderer;
67
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;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I,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,YAAY,aAAa,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;YAEvF,wCAAwC;YACxC,qDAAqD;YACrD,SAAS;YACT,IAAI;gBACF,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;aACzD;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,YAAY,cAAc,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAE7H,SAAS;aACV;YAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,YAAY,aAAa,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;SACjG;IACH,CAAC;CACF;AArDC;IADC,IAAA,YAAM,EAAC,UAAU,CAAC;8BACJ,SAAG;6CAAC;AAGnB;IADC,IAAA,sBAAM,EAAC,uBAAuB,EAAE,EAAE,CAAC;;uDACF;AALpC,4CAuDC"}
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ module.exports = templates;
4
+
5
+ function templates() {
6
+ // TODO
7
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@spinajs/templates",
3
+ "version": "2.0.38",
4
+ "description": "templates support eg. html file generation",
5
+ "main": "lib/index.js",
6
+ "private": false,
7
+ "scripts": {
8
+ "build": "npm run clean && npm run compile",
9
+ "compile": "tsc -p tsconfig.build.json",
10
+ "clean": "",
11
+ "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
12
+ "coverage": "nyc npm run test",
13
+ "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
14
+ "prepare": "npm run build",
15
+ "format": "prettier --write \"src/**/*.ts\"",
16
+ "lint": "eslint -c .eslintrc.js --ext .ts src --fix",
17
+ "prepublishOnly": "npm test && npm run lint",
18
+ "preversion": "npm run lint",
19
+ "version": "npm run format && git add -A src",
20
+ "postversion": "git push && git push --tags"
21
+ },
22
+ "files": [
23
+ "lib/**/*"
24
+ ],
25
+ "types": "lib",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/spinajs/main.git"
29
+ },
30
+ "keywords": [
31
+ "spinajs",
32
+ "http"
33
+ ],
34
+ "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
35
+ "license": "MIT",
36
+ "bugs": {
37
+ "url": "https://github.com/spinajs/main/issues"
38
+ },
39
+ "homepage": "https://github.com/spinajs/main#readme",
40
+ "devDependencies": {
41
+ "@types/handlebars": "^4.1.0",
42
+ "@types/luxon": "^2.3.1",
43
+ "@types/mocha": "9.1.1",
44
+ "@types/node": "^16.11.11",
45
+ "@types/pug": "^2.0.4"
46
+ },
47
+ "dependencies": {
48
+ "@spinajs/cli": "^2.0.38",
49
+ "@spinajs/configuration": "^2.0.38",
50
+ "@spinajs/di": "^2.0.38",
51
+ "@spinajs/exceptions": "^2.0.12",
52
+ "@spinajs/internal-logger": "^2.0.38",
53
+ "@spinajs/intl": "^2.0.38",
54
+ "@spinajs/log": "^2.0.38",
55
+ "handlebars": "^4.7.7",
56
+ "pug": "^3.0.0",
57
+ "tempfile": "3.0.0"
58
+ },
59
+ "gitHead": "5ea5440ee9db49595f531592ebdbc6d69f457082"
60
+ }