Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@prairielearn/html-ejs

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prairielearn/html-ejs - npm Package Compare versions

Comparing version
2.0.10
to
2.0.11
+8
-0
CHANGELOG.md
# @prairielearn/html-ejs
## 2.0.11
### Patch Changes
- 984dc62: Upgrade all JavaScript dependencies
- Updated dependencies [984dc62]
- @prairielearn/html@4.0.11
## 2.0.10

@@ -4,0 +12,0 @@

+1
-1

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

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AACrE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,aAAqB,EAAE,QAAgB,EAAE,OAAY,EAAE;IAC/E,IAAI,YAAY,GAAG,aAAa,CAAC;IAEjC,8EAA8E;IAC9E,oDAAoD;IACpD,IAAI,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,YAAY,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport ejs from 'ejs';\n\nimport { unsafeHtml, type HtmlSafeString } from '@prairielearn/html';\n/**\n * This is a shim to allow for the use of EJS templates inside of HTML tagged\n * template literals.\n *\n * The resulting string is assumed to be appropriately escaped and will be used\n * verbatim in the resulting HTML.\n *\n * @param filePathOrUrl The path or file URL of the file from which relative includes should be resolved.\n * @param template The raw EJS template string.\n * @param data Any data to be made available to the template.\n * @returns The rendered EJS.\n */\nexport function renderEjs(filePathOrUrl: string, template: string, data: any = {}): HtmlSafeString {\n let resolvedPath = filePathOrUrl;\n\n // This allows for us to pass `import.meta.url` to this function in ES Modules\n // environments where `__filename` is not available.\n if (filePathOrUrl.startsWith('file://')) {\n resolvedPath = fileURLToPath(filePathOrUrl);\n }\n\n return unsafeHtml(ejs.render(template, data, { views: [path.dirname(resolvedPath)] }));\n}\n"]}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAuB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,aAAqB,EAAE,QAAgB,EAAE,OAAY,EAAE;IAC/E,IAAI,YAAY,GAAG,aAAa,CAAC;IAEjC,8EAA8E;IAC9E,oDAAoD;IACpD,IAAI,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,YAAY,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport ejs from 'ejs';\n\nimport { type HtmlSafeString, unsafeHtml } from '@prairielearn/html';\n/**\n * This is a shim to allow for the use of EJS templates inside of HTML tagged\n * template literals.\n *\n * The resulting string is assumed to be appropriately escaped and will be used\n * verbatim in the resulting HTML.\n *\n * @param filePathOrUrl The path or file URL of the file from which relative includes should be resolved.\n * @param template The raw EJS template string.\n * @param data Any data to be made available to the template.\n * @returns The rendered EJS.\n */\nexport function renderEjs(filePathOrUrl: string, template: string, data: any = {}): HtmlSafeString {\n let resolvedPath = filePathOrUrl;\n\n // This allows for us to pass `import.meta.url` to this function in ES Modules\n // environments where `__filename` is not available.\n if (filePathOrUrl.startsWith('file://')) {\n resolvedPath = fileURLToPath(filePathOrUrl);\n }\n\n return unsafeHtml(ejs.render(template, data, { views: [path.dirname(resolvedPath)] }));\n}\n"]}
{
"name": "@prairielearn/html-ejs",
"version": "2.0.10",
"version": "2.0.11",
"type": "module",
"main": "dist/index.js",
"repository": {

@@ -11,2 +10,3 @@ "type": "git",

},
"main": "dist/index.js",
"scripts": {

@@ -18,3 +18,3 @@ "build": "tsc",

"dependencies": {
"@prairielearn/html": "^4.0.10",
"@prairielearn/html": "^4.0.11",
"ejs": "^3.1.10"

@@ -25,3 +25,3 @@ },

"@types/ejs": "^3.1.5",
"@types/node": "^20.17.23",
"@types/node": "^20.17.28",
"c8": "^10.1.3",

@@ -28,0 +28,0 @@ "chai": "^5.2.0",

@@ -6,3 +6,3 @@ import path from 'path';

import { unsafeHtml, type HtmlSafeString } from '@prairielearn/html';
import { type HtmlSafeString, unsafeHtml } from '@prairielearn/html';
/**

@@ -9,0 +9,0 @@ * This is a shim to allow for the use of EJS templates inside of HTML tagged