@tsed/engines
Advanced tools
Comparing version 7.61.0 to 7.61.1
@@ -36,3 +36,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("./components/TemplayedEngine"), exports); | ||
tslib_1.__exportStar(require("./components/ToffeeEngine"), exports); | ||
tslib_1.__exportStar(require("./components/TwigEngine"), exports); | ||
@@ -39,0 +38,0 @@ tslib_1.__exportStar(require("./components/TwingEngine"), exports); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readPartials = exports.read = exports.cache = exports.clearCache = exports.getFromCache = exports.setToCache = exports.setEngine = exports.importEngine = exports.getCachedEngine = exports.requires = void 0; | ||
const tslib_1 = require("tslib"); | ||
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra")); | ||
const path_1 = require("path"); | ||
const node_path_1 = require("node:path"); | ||
const readCache = new Map(); | ||
@@ -24,3 +45,3 @@ const cacheStore = new Map(); | ||
async function setEngine(name, toName = name) { | ||
const mdl = await (_a = name, Promise.resolve().then(() => tslib_1.__importStar(require(_a)))); | ||
const mdl = await (_a = name, Promise.resolve().then(() => __importStar(require(_a)))); | ||
exports.requires.set(toName, mdl); | ||
@@ -78,2 +99,3 @@ } | ||
async function read(path, options) { | ||
const fs = await Promise.resolve().then(() => __importStar(require("fs-extra"))); | ||
let str = readCache.get(path); | ||
@@ -85,3 +107,3 @@ // cached (only if cached is a string and not a compiled template function) | ||
// read | ||
str = await fs_extra_1.default.readFile(path, "utf8"); | ||
str = await fs.readFile(path, "utf8"); | ||
// remove extraneous utf8 BOM marker | ||
@@ -121,12 +143,12 @@ str = str.replace(/^\uFEFF/, ""); | ||
let file; | ||
if ((0, path_1.isAbsolute)(partialPath)) { | ||
if ((0, path_1.extname)(partialPath) !== "") { | ||
if ((0, node_path_1.isAbsolute)(partialPath)) { | ||
if ((0, node_path_1.extname)(partialPath) !== "") { | ||
file = partialPath; | ||
} | ||
else { | ||
file = (0, path_1.join)(partialPath + (0, path_1.extname)(path)); | ||
file = (0, node_path_1.join)(partialPath + (0, node_path_1.extname)(path)); | ||
} | ||
} | ||
else { | ||
file = (0, path_1.join)((0, path_1.dirname)(path), partialPath + (0, path_1.extname)(path)); | ||
file = (0, node_path_1.join)((0, node_path_1.dirname)(path), partialPath + (0, node_path_1.extname)(path)); | ||
} | ||
@@ -133,0 +155,0 @@ try { |
@@ -33,3 +33,2 @@ /** | ||
export * from "./components/TemplayedEngine.js"; | ||
export * from "./components/ToffeeEngine.js"; | ||
export * from "./components/TwigEngine.js"; | ||
@@ -36,0 +35,0 @@ export * from "./components/TwingEngine.js"; |
@@ -1,3 +0,2 @@ | ||
import fs from "fs-extra"; | ||
import { dirname, extname, isAbsolute, join } from "path"; | ||
import { dirname, extname, isAbsolute, join } from "node:path"; | ||
const readCache = new Map(); | ||
@@ -65,2 +64,3 @@ const cacheStore = new Map(); | ||
export async function read(path, options) { | ||
const fs = await import("fs-extra"); | ||
let str = readCache.get(path); | ||
@@ -67,0 +67,0 @@ // cached (only if cached is a string and not a compiled template function) |
@@ -33,3 +33,2 @@ /** | ||
export * from "./components/TemplayedEngine"; | ||
export * from "./components/ToffeeEngine"; | ||
export * from "./components/TwigEngine"; | ||
@@ -36,0 +35,0 @@ export * from "./components/TwingEngine"; |
{ | ||
"name": "@tsed/engines", | ||
"version": "7.61.0", | ||
"version": "7.61.1", | ||
"description": "Template engines library. Provide an API to adding custom engines from decorators.", | ||
@@ -23,3 +23,2 @@ "source": "./src/index.ts", | ||
}, | ||
"private": false, | ||
"dependencies": { | ||
@@ -35,9 +34,11 @@ "filedirname": "^2.7.0", | ||
"@babel/preset-react": "7.22.15", | ||
"@tsed/eslint": "7.44.1", | ||
"@tsed/typescript": "7.44.1", | ||
"@tsed/eslint": "7.61.1", | ||
"@tsed/typescript": "7.61.1", | ||
"@types/fs-extra": "^11.0.3", | ||
"@types/semver": "^7.3.9", | ||
"atpl": "0.9.3", | ||
"barrelsby": "^2.8.1", | ||
"bracket-template": "^1.1.5", | ||
"coffee-script": "^1.12.7", | ||
"cross-env": "7.0.3", | ||
"dot": "^1.1.3", | ||
@@ -59,2 +60,3 @@ "dust": "^0.3.0", | ||
"jazz": "^0.0.18", | ||
"jest": "^29.2.0", | ||
"jqtpl": "^1.1.0", | ||
@@ -81,3 +83,2 @@ "just": "^0.1.8", | ||
"tinyliquid": "^0.2.34", | ||
"toffee": "^0.3.6", | ||
"ts-node": "10.9.2", | ||
@@ -84,0 +85,0 @@ "twig": "^1.15.2", |
@@ -81,3 +81,2 @@ <p style="text-align: center" align="center"> | ||
| [templayed](https://github.com/archan937/templayed.js/) | [`npm install templayed`](https://www.npmjs.com/package/templayed) | [(website)](http://archan937.github.com/templayed.js/) | | ||
| [toffee](https://github.com/malgorithms/toffee) | [`npm install toffee`](https://www.npmjs.com/package/toffee) | - | | ||
| [twig](https://github.com/justjohn/twig.js) | [`npm install twig`](https://www.npmjs.com/package/twig) | [(wiki)](https://github.com/twigjs/twig.js/wiki/Implementation-Notes) | | ||
@@ -84,0 +83,0 @@ | [twing](https://github.com/NightlyCommit/twing) | [`npm install twing`](https://www.npmjs.com/package/twing) | [(website)](https://nightlycommit.github.io/twing/) | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8
192775
59
209
2575
292