You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

vite-plugin-esi

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-esi - npm Package Compare versions

Comparing version
1.0.9
to
1.1.0
+1
-5
dist/errors.js

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TagsNotFoundError = void 0;
class TagsNotFoundError extends Error {
export class TagsNotFoundError extends Error {
constructor(message) {

@@ -10,2 +7,1 @@ super(message);

}
exports.TagsNotFoundError = TagsNotFoundError;
+4
-7

@@ -1,5 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const transform_1 = require("./transform");
function esiPlugin(options) {
import { resolveESI, transformHtml } from './transform';
export default function esiPlugin(options) {
var _a;

@@ -10,5 +8,5 @@ const shouldResolveESI = (_a = options.resolveESI) !== null && _a !== void 0 ? _a : true;

transformIndexHtml(inputHtml) {
const html = (0, transform_1.transformHtml)(inputHtml, options.esi);
const html = transformHtml(inputHtml, options.esi);
if (shouldResolveESI) {
return (0, transform_1.resolveESI)(html);
return resolveESI(html);
}

@@ -18,2 +16,1 @@ },

}
exports.default = esiPlugin;

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

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -11,11 +10,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveESI = exports.transformHtml = void 0;
const nodesi_1 = __importDefault(require("nodesi"));
const errors_1 = require("./errors");
import ESI from 'nodesi';
import { TagsNotFoundError } from './errors';
// Will transform the html by replacing the special comments with the esi tags
function transformHtml(html, options) {
export function transformHtml(html, options) {
const regex = /<!--*\s*vite-plugin-esi\s(name="(?<name>[a-zA-Z0-9]+)").*->/g; // example <!-- vite-plugin-esi name="header" -->

@@ -25,3 +19,3 @@ return html.replace(regex, (_match, _, __, ___, ____, groups) => {

if (!tags) {
throw new errors_1.TagsNotFoundError(`no tags found for ${groups.name}`);
throw new TagsNotFoundError(`no tags found for ${groups.name}`);
}

@@ -36,6 +30,5 @@ return tags

}
exports.transformHtml = transformHtml;
function resolveESI(html, options) {
export function resolveESI(html, options) {
return __awaiter(this, void 0, void 0, function* () {
const esi = new nodesi_1.default(options);
const esi = new ESI(options);
const resolvedHtml = yield esi.process(html);

@@ -45,2 +38,1 @@ return resolvedHtml;

}
exports.resolveESI = resolveESI;

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

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
{
"name": "vite-plugin-esi",
"version": "1.0.9",
"version": "1.1.0",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"repository": {

@@ -8,0 +9,0 @@ "url": "https://github.com/marcusthelin/vite-plugin-esi"