Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-node

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-node - npm Package Compare versions

Comparing version 3.0.2 to 3.1.0

7

dist/index.d.ts
/// <reference types="node" />
import type http from 'http';
import type { IncomingMessage, ServerResponse } from 'http';
import type { Options } from '@swc/core';

@@ -12,4 +12,4 @@ import type { Connect, UserConfig, ViteDevServer } from 'vite';

server: ViteDevServer;
req: http.IncomingMessage;
res: http.ServerResponse;
req: IncomingMessage;
res: ServerResponse;
next: Connect.NextFunction;

@@ -24,2 +24,3 @@ }

appName?: string;
initAppOnBoot?: boolean;
exportName?: string;

@@ -26,0 +27,0 @@ tsCompiler?: SupportedTSCompiler;

/// <reference types="express" />
/// <reference types="koa" />
/// <reference types="node" />
import type http from 'http';
import type { IncomingMessage, ServerResponse } from 'http';
import type { Connect, ViteDevServer } from 'vite';

@@ -12,3 +12,3 @@ import type { RequestAdapter, VitePluginNodeConfig } from '..';

koa: RequestAdapter<import("koa")<import("koa").DefaultState, import("koa").DefaultContext>>;
fastify: RequestAdapter<import("fastify").FastifyInstance<http.Server, http.IncomingMessage, http.ServerResponse, import("fastify").FastifyLoggerInstance>>;
fastify: RequestAdapter<import("fastify").FastifyInstance<import("http").Server, IncomingMessage, ServerResponse, import("fastify").FastifyLoggerInstance>>;
marble: RequestAdapter<import("./marble").MarbleContext>;

@@ -15,0 +15,0 @@ };

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

const requestHandler = getRequestHandler(config.adapter);
if (!requestHandler) {
console.error('Failed to find a request handler');
process.exit(1);
}
return async function (req, res, next) {
async function _loadApp(config) {
const appModule = await server.ssrLoadModule(config.appPath);

@@ -63,4 +59,18 @@ let app = appModule[config.exportName];

app = await app;
return app;
}
}
if (!requestHandler) {
console.error('Failed to find a request handler');
process.exit(1);
}
if (config.initAppOnBoot) {
server.httpServer.once('listening', async () => {
await _loadApp(config);
});
}
return async function (req, res, next) {
const app = await _loadApp(config);
if (app)
await requestHandler({ app, server, req, res, next });
}
};

@@ -67,0 +77,0 @@ };

@@ -12,3 +12,3 @@ "use strict";

function VitePluginNode(cfg) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e;
const swcOptions = (0, utils_1.default)({

@@ -36,2 +36,3 @@ module: {

exportName: (_d = cfg.exportName) !== null && _d !== void 0 ? _d : 'viteNodeApp',
initAppOnBoot: (_e = cfg.initAppOnBoot) !== null && _e !== void 0 ? _e : false,
swcOptions,

@@ -38,0 +39,0 @@ };

{
"name": "vite-plugin-node",
"version": "3.0.2",
"version": "3.1.0",
"description": "Vite plugin to enable your node server HMR",

@@ -57,2 +57,3 @@ "author": "Axe",

"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.5",

@@ -67,4 +68,4 @@ "vite": "^4.0.0"

"format": "prettier --write .",
"prebuild": "rimraf dist && npm run lint && cp ../../readme.md ./readme.md"
"prebuild": "rimraf dist && npm run lint && cp ../../README.md ./readme.md"
}
}

@@ -57,2 +57,6 @@ <p align="center">

// Optional, default: false
// if you want to init your app on boot, set this to true
initAppOnBoot: false,
// Optional, default: 'esbuild'

@@ -59,0 +63,0 @@ // The TypeScript compiler you want to use

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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