
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
vite-plugin-inline-source
Advanced tools
A Vite plugin which inlines source files in HTML files where the inline-source
attribute is present. This is similar in premise to vite-plugin-singlefile, but allows you to control which assets are inlined.
This plugin was heavily influenced by markup-inline-loader for webpack. I wanted the same functionality, but couldn't find a suitable replacement in the Vite ecosystem.
Check out the interactive demo on StackBlitz!
vite.config.ts
import { defineConfig } from "vite";
import inlineSource from "vite-plugin-inline-source";
export default defineConfig({
plugins: [
inlineSource(),
],
});
style.css
body {
background-color: red;
}
index.html
<html>
<style inline-source src="style.css"></style>
</html>
Resulting index.html after build
<html>
<style inline-source>body {
background-color: red;
}
</style>
</html>
Tags that should be replaced in the HTML file.
For example, style
and script
tags are not replaced by default because the corresponding css/js file would not contain the style
or script
tag. However, with svg
tags, the corresponding svg file would contain the svg
tag, so the svg
tags in the HTML file are replaced. See the unit tests for more explicit examples.
string[]
['svg', 'math']
Whether or not to optimize SVGs using svgo.
boolean
true
Options to pass to svgo. Only used if optimizeSvgs
is true
.
OptimizeOptions
{}
Whether or not to optimize CSS using csso.
boolean
false
Options to pass to csso. Only used if optimizeCss
is true
.
OptimizeOptions
{}
Whether or not to optimize JS using terser.
boolean
false
Options to pass to terser. Only used if optimizeJs
is true
.
OptimizeOptions
{}
Whether or not to compile SASS using sass.
boolean
false
Options to pass to sass. Only used if compileSass
is true
.
OptimizeOptions
{}
FAQs
A vite plugin for inlining files into HTML
The npm package vite-plugin-inline-source receives a total of 9,504 weekly downloads. As such, vite-plugin-inline-source popularity was classified as popular.
We found that vite-plugin-inline-source demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.