New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lwrjs/base-template-engine

Package Overview
Dependencies
Maintainers
7
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwrjs/base-template-engine - npm Package Compare versions

Comparing version 0.0.2-alpha3 to 0.0.2-alpha30

8

build/engine/index.d.ts

@@ -7,4 +7,10 @@ import templateEngine from './micro-template';

}
export declare function templateMiddleware({ views, layouts, defaultLayout }: EngineConfig): any;
interface LayoutContext {
title: string;
lwr_resources: string;
layout: string;
}
declare type MiddlewareFunction = <T extends LayoutContext>(filePath: string, context: Partial<T>, callback: Function) => void;
export declare function templateMiddleware({ views, layouts, defaultLayout, }: EngineConfig): MiddlewareFunction;
export { templateEngine };
//# sourceMappingURL=index.d.ts.map

3

build/engine/index.js

@@ -7,2 +7,3 @@ "use strict";

exports.templateEngine = exports.templateMiddleware = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars */
const micro_template_1 = __importDefault(require("./micro-template"));

@@ -16,3 +17,3 @@ exports.templateEngine = micro_template_1.default;

}
function templateMiddleware({ views, layouts, defaultLayout = 'main' }) {
function templateMiddleware({ views, layouts, defaultLayout = 'main', }) {
return function (filePath, context, callback) {

@@ -19,0 +20,0 @@ const { title = 'LWR', layout } = context;

@@ -1,2 +0,2 @@

export default function template(template: any, data: any): string;
export default function template(template: string, data: Record<string, any>): string;
//# sourceMappingURL=micro-template.d.ts.map
"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any */
// Ported and inspired by from https://github.com/sindresorhus/pupa/blob/master/index.js
// The semantics of double and triple brackets follow handlebars.
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-explicit-any */
// Ported from https://github.com/sindresorhus/pupa/blob/master/index.js
const escape_goat_1 = require("escape-goat");

@@ -13,2 +14,12 @@ function template(template, data) {

}
const triplebraceRegex = /{{{(.*?)}}}/g;
if (triplebraceRegex.test(template)) {
template = template.replace(triplebraceRegex, (_, key) => {
let result = data;
for (const property of key.split('.')) {
result = result ? result[property] : '';
}
return String(result);
});
}
const doubleBraceRegex = /{{(.*?)}}/g;

@@ -24,12 +35,5 @@ if (doubleBraceRegex.test(template)) {

}
const braceRegex = /{(.*?)}/g;
return template.replace(braceRegex, (_, key) => {
let result = data;
for (const property of key.split('.')) {
result = result ? result[property] : '';
}
return String(result);
});
return template;
}
exports.default = template;
//# sourceMappingURL=micro-template.js.map

@@ -1,5 +0,6 @@

import { LwrGlobalConfig } from '@lwrjs/types';
import { NormalizedLwrGlobalConfig } from '@lwrjs/types';
import express from 'express';
export declare function registerEngine(app: express.Application, config: LwrGlobalConfig): void;
export declare function render(data: string, context: any): string;
import { templateEngine } from './engine/index';
export declare function registerEngine(app: express.Application, config: NormalizedLwrGlobalConfig): void;
export { templateEngine as render };
//# sourceMappingURL=index.d.ts.map

@@ -5,5 +5,6 @@ "use strict";

const index_1 = require("./engine/index");
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return index_1.templateEngine; } });
function registerEngine(app, config) {
const viewsDir = config.application.views[0];
const layoutsDir = config.application.layouts[0];
const viewsDir = config.contentDir;
const layoutsDir = config.layoutsDir;
app.engine('html', index_1.templateMiddleware({

@@ -17,6 +18,2 @@ views: viewsDir,

exports.registerEngine = registerEngine;
function render(data, context) {
return index_1.templateEngine(data, context);
}
exports.render = render;
//# sourceMappingURL=index.js.map

@@ -7,3 +7,3 @@ {

},
"version": "0.0.2-alpha3",
"version": "0.0.2-alpha30",
"homepage": "https://lwr.dev/",

@@ -27,3 +27,3 @@ "repository": {

},
"gitHead": "0a3ec38ad674e502f5dae4d232de8975fb0e4d76"
"gitHead": "ec31eb8e6e809d9afc95f63c0428e04a5830451d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc