vite-plugin-node
Advanced tools
Comparing version 3.1.0 to 4.0.0
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import type { IncomingMessage, ServerResponse } from 'http'; | ||
@@ -19,2 +18,4 @@ import type { Options } from '@swc/core'; | ||
export declare type SupportedTSCompiler = 'esbuild' | 'swc'; | ||
export type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd'; | ||
export type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs'; | ||
export interface VitePluginNodeConfig { | ||
@@ -28,2 +29,3 @@ appPath: string; | ||
swcOptions?: Options; | ||
outputFormat?: ModuleFormat; | ||
} | ||
@@ -30,0 +32,0 @@ export declare interface ViteConfig extends UserConfig { |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RollupPluginSwc = void 0; | ||
exports.RollupPluginSwc = RollupPluginSwc; | ||
const pluginutils_1 = require("@rollup/pluginutils"); | ||
@@ -43,3 +43,3 @@ const utils_1 = require("./utils"); | ||
if (!swc) | ||
swc = await Promise.resolve().then(() => __importStar(require('@swc/core'))); | ||
swc = await Promise.resolve().then(() => __importStar(require('@swc/core'))).then(({ Compiler }) => new Compiler()); | ||
const result = await swc.transform(code, { | ||
@@ -57,3 +57,2 @@ ...config, | ||
} | ||
exports.RollupPluginSwc = RollupPluginSwc; | ||
//# sourceMappingURL=rollup-plugin-swc.js.map |
@@ -1,4 +0,1 @@ | ||
/// <reference types="express" /> | ||
/// <reference types="koa" /> | ||
/// <reference types="node" /> | ||
import type { IncomingMessage, ServerResponse } from 'http'; | ||
@@ -12,3 +9,3 @@ import type { Connect, ViteDevServer } from 'vite'; | ||
koa: RequestAdapter<import("koa")<import("koa").DefaultState, import("koa").DefaultContext>>; | ||
fastify: RequestAdapter<import("fastify").FastifyInstance<import("http").Server, IncomingMessage, ServerResponse, import("fastify").FastifyLoggerInstance>>; | ||
fastify: RequestAdapter<import("fastify").FastifyInstance<import("fastify").RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, import("fastify").FastifyLoggerInstance>>; | ||
marble: RequestAdapter<import("./marble").MarbleContext>; | ||
@@ -15,0 +12,0 @@ }; |
@@ -27,3 +27,3 @@ "use strict"; | ||
const plugin = server.config.plugins.find(p => p.name === __1.PLUGIN_NAME); | ||
let userConfig; | ||
let userConfig = null; | ||
if (typeof plugin.config === 'function') | ||
@@ -30,0 +30,0 @@ userConfig = await plugin.config({}, env); |
@@ -6,2 +6,2 @@ export declare function createDebugger(ns: string): (msg: string, ...args: any[]) => void; | ||
export declare function isObject(item: any): item is object; | ||
export default function mergeDeep(target: object, source: object): {} & object; | ||
export default function mergeDeep(target: object, source: object): object; |
@@ -6,3 +6,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isObject = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.createDebugger = void 0; | ||
exports.cleanUrl = exports.hashRE = exports.queryRE = void 0; | ||
exports.createDebugger = createDebugger; | ||
exports.isObject = isObject; | ||
exports.default = mergeDeep; | ||
/** | ||
@@ -18,3 +21,2 @@ * modified from vitejs source code, just to make the console output looks vite-like | ||
} | ||
exports.createDebugger = createDebugger; | ||
exports.queryRE = /\?.*$/; | ||
@@ -27,3 +29,2 @@ exports.hashRE = /#.*$/; | ||
} | ||
exports.isObject = isObject; | ||
function mergeDeep(target, source) { | ||
@@ -52,3 +53,2 @@ const output = Object.assign({}, target); | ||
} | ||
exports.default = mergeDeep; | ||
//# sourceMappingURL=utils.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VitePluginNode = void 0; | ||
exports.VitePluginNode = VitePluginNode; | ||
const rollup_plugin_swc_1 = require("./rollup-plugin-swc"); | ||
@@ -13,3 +13,3 @@ const server_1 = require("./server"); | ||
function VitePluginNode(cfg) { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b, _c, _d, _e, _f; | ||
const swcOptions = (0, utils_1.default)({ | ||
@@ -38,2 +38,3 @@ module: { | ||
initAppOnBoot: (_e = cfg.initAppOnBoot) !== null && _e !== void 0 ? _e : false, | ||
outputFormat: (_f = cfg.outputFormat) !== null && _f !== void 0 ? _f : 'cjs', | ||
swcOptions, | ||
@@ -50,2 +51,5 @@ }; | ||
input: config.appPath, | ||
output: { | ||
format: config.outputFormat, | ||
}, | ||
}, | ||
@@ -57,2 +61,3 @@ }, | ||
optimizeDeps: { | ||
noDiscovery: true, | ||
// Vite does not work well with optionnal dependencies, | ||
@@ -82,3 +87,2 @@ // mark them as ignored for now | ||
} | ||
exports.VitePluginNode = VitePluginNode; | ||
//# sourceMappingURL=vite-plugin-node.js.map |
{ | ||
"name": "vite-plugin-node", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"description": "Vite plugin to enable your node server HMR", | ||
@@ -32,4 +32,4 @@ "author": "Axe", | ||
"peerDependencies": { | ||
"@swc/core": "^1.2.153", | ||
"vite": "^4.0.0" | ||
"@swc/core": "^1.7.26", | ||
"vite": "^5.0.0" | ||
}, | ||
@@ -45,3 +45,3 @@ "peerDependenciesMeta": { | ||
"@nestjs/common": "^8.0.9", | ||
"@swc/core": "^1.2.155", | ||
"@swc/core": "^1.7.26", | ||
"@types/debug": "^4.1.7", | ||
@@ -51,3 +51,3 @@ "@types/estree": "^0.0.50", | ||
"@types/koa": "^2.13.4", | ||
"@types/node": "^16.10.2", | ||
"@types/node": "^18.19.55", | ||
"@types/rx": "^4.1.2", | ||
@@ -62,3 +62,3 @@ "express": "^4.17.1", | ||
"rxjs": "^7.5.5", | ||
"vite": "^4.0.0" | ||
"vite": "^5.4.8" | ||
}, | ||
@@ -65,0 +65,0 @@ "scripts": { |
@@ -86,15 +86,2 @@ <p align="center"> | ||
], | ||
optimizeDeps: { | ||
// Vite does not work well with optionnal dependencies, | ||
// you can mark them as ignored for now | ||
// eg: for nestjs, exlude these optional dependencies: | ||
// exclude: [ | ||
// '@nestjs/microservices', | ||
// '@nestjs/websockets', | ||
// 'cache-manager', | ||
// 'class-transformer', | ||
// 'class-validator', | ||
// 'fastify-swagger', | ||
// ], | ||
}, | ||
}); | ||
@@ -101,0 +88,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33963
398
181