Socket
Socket
Sign inDemoInstall

@unocss/vite

Package Overview
Dependencies
Maintainers
1
Versions
366
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unocss/vite - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

56

dist/index.js

@@ -1417,3 +1417,3 @@ var __create = Object.create;

var import_pluginutils2 = __toModule(require("@rollup/pluginutils"));
var VIRTUAL_ENTRY = "/@unocss-entry";
var VIRTUAL_ENTRY = "/@unocss-entry.css";
var READY_CALLBACK = "/__unocss_ready";

@@ -1449,2 +1449,3 @@ function GlobalModeDevPlugin({ config, uno, tokens, onInvalidate, scan }) {

onInvalidate(invalidate);
let mainEntry;
return {

@@ -1458,11 +1459,3 @@ name: "unocss:global",

if (req.url === READY_CALLBACK) {
let body = "";
await new Promise((resolve) => {
req.on("data", (chunk) => {
body += chunk;
});
req.on("end", resolve);
});
if (+body !== lastUpdate)
sendUpdate();
sendUpdate();
res.statusCode = 200;

@@ -1475,6 +1468,14 @@ res.end();

},
transform(code, id) {
if (!filter(id))
return;
scan(code, id);
transform(code, id, context) {
const isSSR = context === true || (context == null ? void 0 : context.ssr) === true;
if (filter(id))
scan(code, id);
if (!isSSR && (mainEntry == null || mainEntry === id) && !id.includes("node_modules/vite")) {
mainEntry = id;
code = `
await import("${VIRTUAL_ENTRY}").then(() => fetch('${READY_CALLBACK}'));
${code}
`;
return code;
}
return null;

@@ -1485,4 +1486,3 @@ },

},
async load(id, context) {
const isSSR = context === true || (context == null ? void 0 : context.ssr) === true;
async load(id) {
if (id !== VIRTUAL_ENTRY)

@@ -1492,25 +1492,3 @@ return null;

const { css } = await uno.generate(tokens);
if (isSSR) {
return `export default ${JSON.stringify(`/* unocss */
${css}`)}`;
} else {
return `
import { updateStyle, removeStyle } from "/@vite/client";
const id = "${VIRTUAL_ENTRY}"
import.meta.hot.accept()
import.meta.hot.prune(() => removeStyle(id))
const css = ${JSON.stringify(`/* unocss */
${css}`)}
updateStyle(id, css)
export default css
fetch('${READY_CALLBACK}', { method: 'POST', body: '${lastUpdate}' })
`;
}
},
transformIndexHtml: {
enforce: "pre",
async transform(code, { path }) {
tasks.push(scan(code, path));
return `${code}<script src="${VIRTUAL_ENTRY}" type="module"><\/script>`;
}
return css;
}

@@ -1517,0 +1495,0 @@ };

{
"name": "@unocss/vite",
"version": "0.1.2",
"version": "0.1.3",
"description": "",

@@ -32,5 +32,5 @@ "keywords": [],

"@rollup/pluginutils": "^4.1.1",
"@unocss/config": "0.1.2",
"@unocss/core": "0.1.2",
"@unocss/scope": "0.1.2",
"@unocss/config": "0.1.3",
"@unocss/core": "0.1.3",
"@unocss/scope": "0.1.3",
"nanoevents": "^6.0.2"

@@ -37,0 +37,0 @@ },

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