🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@rg-dev/stdlib

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rg-dev/stdlib - npm Package Compare versions

Comparing version
1.0.57
to
1.0.58
+64
lib/vite-helpers.cjs
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/vite-helpers.ts
var vite_helpers_exports = {};
__export(vite_helpers_exports, {
VERSION: () => VERSION,
createViteMiddleware: () => createViteMiddleware
});
module.exports = __toCommonJS(vite_helpers_exports);
// src/index.ts
var VERSION = "1";
// src/common-env.ts
function isNonEmptyString(str) {
return typeof str == "string" && str.trim().length > 0;
}
// src/vite-helpers.ts
async function createViteMiddleware(rootPath, editHtmlFn) {
if (!isNonEmptyString(rootPath)) {
throw new Error("invalid rootPath");
}
console.log(`starting vite middleware in ${rootPath}`);
const vite = await require(Function(`return 'vite'`)()).createServer(
{
root: rootPath,
logLevel: "info",
server: {
middlewareMode: true,
watch: {
usePolling: true,
interval: 300
}
},
plugins: [
{
name: "html-base-url",
transformIndexHtml(html) {
return (editHtmlFn == null ? void 0 : editHtmlFn(html)) || html;
}
}
]
}
);
return vite.middlewares;
}
import { Handler } from 'express';
export { VERSION } from './index.cjs';
declare function createViteMiddleware(rootPath: string, editHtmlFn?: (html: string) => string): Promise<Handler>;
export { createViteMiddleware };
import { Handler } from 'express';
export { VERSION } from './index.js';
declare function createViteMiddleware(rootPath: string, editHtmlFn?: (html: string) => string): Promise<Handler>;
export { createViteMiddleware };
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
// src/index.ts
var VERSION = "1";
// src/common-env.ts
function isNonEmptyString(str) {
return typeof str == "string" && str.trim().length > 0;
}
// src/vite-helpers.ts
async function createViteMiddleware(rootPath, editHtmlFn) {
if (!isNonEmptyString(rootPath)) {
throw new Error("invalid rootPath");
}
console.log(`starting vite middleware in ${rootPath}`);
const vite = await __require(Function(`return 'vite'`)()).createServer(
{
root: rootPath,
logLevel: "info",
server: {
middlewareMode: true,
watch: {
usePolling: true,
interval: 300
}
},
plugins: [
{
name: "html-base-url",
transformIndexHtml(html) {
return (editHtmlFn == null ? void 0 : editHtmlFn(html)) || html;
}
}
]
}
);
return vite.middlewares;
}
export {
VERSION,
createViteMiddleware
};
+1
-0

@@ -7,3 +7,4 @@ import './browser-env';

import './axios-helpers'
import './vite-helpers'
export declare const VERSION:string

@@ -7,3 +7,4 @@ import './browser-env';

import './axios-helpers'
import './vite-helpers'
export declare const VERSION:string
{
"name": "@rg-dev/stdlib",
"version": "1.0.57",
"version": "1.0.58",
"description": "",

@@ -34,2 +34,5 @@ "scripts": {

"lib/axios-helpers.d.ts"
],
"lib/vite-helpers": [
"lib/vite-helpers.d.ts"
]

@@ -74,2 +77,7 @@ }

"types": "./lib/node-download.d.ts"
},
"./lib/vite-helpers": {
"import": "./lib/vite-helpers.js",
"require": "./lib/vite-helpers.cjs",
"types": "./lib/vite-helpers.d.ts"
}

@@ -76,0 +84,0 @@ },