Socket
Book a DemoInstallSign in
Socket

vite-plugin-singlefile

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-singlefile - npm Package Compare versions

Comparing version

to
0.12.2

13

dist/cjs/index.js

@@ -73,9 +73,8 @@ "use strict";

// Optionally remove the Vite module loader since it's no longer needed because this plugin has inlined all code.
const _removeViteModuleLoader = (html) => {
const match = html.match(/(<script type="module">[\s\S]*)(const (\S)=function\(\)\{[\s\S]*\};\3\(\);)/);
// Graceful fallback if Vite updates the format of their module loader in the future.
if (!match || match.length < 3)
return html;
return html.replace(match[1], ' <script type="module">').replace(match[2], "");
};
// This assumes that the Module Loader is (1) the FIRST function declared in the module, (2) an IIFE, (3) is minified,
// (4) is within a script with no unexpected attribute values, and (5) that the containing script is the first script
// tag that matches the above criteria. Changes to the SCRIPT tag especially could break this again in the future.
// Update example:
// https://github.com/richardtallent/vite-plugin-singlefile/issues/57#issuecomment-1263950209
const _removeViteModuleLoader = (html) => html.replace(/(<script type="module" crossorigin>\s*)\(function\(\)\{[\s\S]*?\}\)\(\);/, '<script type="module">\n');
// Modifies the Vite build config to make this plugin work well.

@@ -82,0 +81,0 @@ const _useRecommendedBuildConfig = (config) => {

@@ -64,9 +64,8 @@ import micromatch from "micromatch";

// Optionally remove the Vite module loader since it's no longer needed because this plugin has inlined all code.
const _removeViteModuleLoader = (html) => {
const match = html.match(/(<script type="module">[\s\S]*)(const (\S)=function\(\)\{[\s\S]*\};\3\(\);)/);
// Graceful fallback if Vite updates the format of their module loader in the future.
if (!match || match.length < 3)
return html;
return html.replace(match[1], ' <script type="module">').replace(match[2], "");
};
// This assumes that the Module Loader is (1) the FIRST function declared in the module, (2) an IIFE, (3) is minified,
// (4) is within a script with no unexpected attribute values, and (5) that the containing script is the first script
// tag that matches the above criteria. Changes to the SCRIPT tag especially could break this again in the future.
// Update example:
// https://github.com/richardtallent/vite-plugin-singlefile/issues/57#issuecomment-1263950209
const _removeViteModuleLoader = (html) => html.replace(/(<script type="module" crossorigin>\s*)\(function\(\)\{[\s\S]*?\}\)\(\);/, '<script type="module">\n');
// Modifies the Vite build config to make this plugin work well.

@@ -73,0 +72,0 @@ const _useRecommendedBuildConfig = (config) => {

{
"name": "vite-plugin-singlefile",
"version": "0.12.1",
"version": "0.12.2",
"description": "Vite plugin for inlining JavaScript and CSS resources",

@@ -46,15 +46,15 @@ "main": "dist/cjs/index.js",

"peerDependencies": {
"vite": "^3.1.3",
"rollup": "~2.78.0"
"vite": "^3.1.4",
"rollup": "~2.79.1"
},
"devDependencies": {
"@types/jest": "^29.0.3",
"@types/jest": "^29.1.1",
"@types/micromatch": "^4.0.2",
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.23.1",
"jest": "^29.0.3",
"@types/node": "^18.7.23",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"eslint": "^8.24.0",
"jest": "^29.1.2",
"rimraf": "^3.0.2",
"typescript": "^4.8.3"
"typescript": "^4.8.4"
},

@@ -61,0 +61,0 @@ "prettier": {