@spinajs/templates 2.0.79 → 2.0.81
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/interfaces.d.ts +0 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js +0 -36
- package/lib/interfaces.js.map +1 -1
- package/package.json +7 -7
package/lib/interfaces.d.ts
CHANGED
|
@@ -17,6 +17,5 @@ export declare abstract class TemplateRenderer extends AsyncService implements I
|
|
|
17
17
|
* @param path - template full path
|
|
18
18
|
*/
|
|
19
19
|
protected abstract compile(templateName: string, path: string): Promise<void>;
|
|
20
|
-
resolve(): Promise<void>;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=interfaces.d.ts.map
|
package/lib/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAU,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAU,GAAG,EAAE,MAAM,cAAc,CAAC;AAG3C,8BAAsB,gBAAiB,SAAQ,YAAa,YAAW,gBAAgB;IAErF,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IAGnB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IAElC,SAAS,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAA+B;IAE7E,aAAoB,IAAI,IAAI,MAAM,CAAC;IAEnC,aAAoB,SAAS,IAAI,MAAM,CAAC;IAExC,IAAW,WAAW,WAGrB;aAEe,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;aAChF,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtH;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAC9E"}
|
package/lib/interfaces.js
CHANGED
|
@@ -10,8 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
import { Config } from '@spinajs/configuration';
|
|
11
11
|
import { AsyncService } from '@spinajs/di';
|
|
12
12
|
import { Logger, Log } from '@spinajs/log';
|
|
13
|
-
import { join } from 'path';
|
|
14
|
-
import glob from 'glob';
|
|
15
13
|
export class TemplateRenderer extends AsyncService {
|
|
16
14
|
constructor() {
|
|
17
15
|
super(...arguments);
|
|
@@ -21,40 +19,6 @@ export class TemplateRenderer extends AsyncService {
|
|
|
21
19
|
// we map this service by extension
|
|
22
20
|
return this.Extension;
|
|
23
21
|
}
|
|
24
|
-
async resolve() {
|
|
25
|
-
for (const path of this.TemplatePaths) {
|
|
26
|
-
const files = glob.sync(join(path, `/**/*${this.Extension}`).replace(/\\/g, '/'));
|
|
27
|
-
for (const file of files) {
|
|
28
|
-
const templateName = file.substring(path.length + 1, file.length);
|
|
29
|
-
if (this.TemplateFiles.has(templateName)) {
|
|
30
|
-
this.Log.trace(`Template ${templateName} is overriden by ${file}`);
|
|
31
|
-
this.TemplateFiles.get(templateName).push(file);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.Log.trace(`Found template ${templateName} file at path ${file}`);
|
|
35
|
-
this.TemplateFiles.set(templateName, [file]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
for (const [templateName, path] of this.TemplateFiles) {
|
|
40
|
-
if (path.length === 0) {
|
|
41
|
-
this.Log.warn(`Template ${templateName} don't have any files`);
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
this.Log.trace(`Compiling template ${templateName}, at path ${path[path.length - 1]}`);
|
|
45
|
-
// compile only last template ( newest )
|
|
46
|
-
// templates can be overriden by other modules / libs
|
|
47
|
-
// or app
|
|
48
|
-
try {
|
|
49
|
-
await this.compile(templateName, path[path.length - 1]);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
this.Log.error(`Cannot compile template ${templateName} with file ${path[path.length - 1]}, reason: ${JSON.stringify(err)}`);
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
this.Log.trace(`Compiling template ${templateName}, at path ${path[path.length - 1]} finished`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
22
|
}
|
|
59
23
|
__decorate([
|
|
60
24
|
Logger('renderer'),
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,OAAgB,gBAAiB,SAAQ,YAAY;IAA3D;;QAOY,kBAAa,GAA0B,IAAI,GAAG,EAAoB,CAAC;IAqB/E,CAAC;IAfC,IAAW,WAAW;QACpB,mCAAmC;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CAYF;AA3BC;IAAC,MAAM,CAAC,UAAU,CAAC;8BACJ,GAAG;6CAAC;AAEnB;IAAC,MAAM,CAAC,uBAAuB,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;;uDACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinajs/templates",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.81",
|
|
4
4
|
"description": "templates support eg. html file generation",
|
|
5
5
|
"exports": "./lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"rimraf": "^4.1.2"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@spinajs/cli": "^2.0.
|
|
52
|
-
"@spinajs/configuration": "^2.0.
|
|
53
|
-
"@spinajs/di": "^2.0.
|
|
54
|
-
"@spinajs/exceptions": "^2.0.
|
|
55
|
-
"@spinajs/intl": "^2.0.
|
|
56
|
-
"@spinajs/log": "^2.0.
|
|
51
|
+
"@spinajs/cli": "^2.0.81",
|
|
52
|
+
"@spinajs/configuration": "^2.0.81",
|
|
53
|
+
"@spinajs/di": "^2.0.81",
|
|
54
|
+
"@spinajs/exceptions": "^2.0.81",
|
|
55
|
+
"@spinajs/intl": "^2.0.81",
|
|
56
|
+
"@spinajs/log": "^2.0.81",
|
|
57
57
|
"tempfile": "4.0.0"
|
|
58
58
|
},
|
|
59
59
|
"gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
|