@unocss/vite
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -1453,2 +1453,5 @@ var __create = Object.create; | ||
enforce: "pre", | ||
buildStart() { | ||
mainEntry = void 0; | ||
}, | ||
configureServer(_server) { | ||
@@ -1472,7 +1475,8 @@ server = _server; | ||
mainEntry = id; | ||
code = ` | ||
await import("${VIRTUAL_ENTRY}").then(() => fetch('${READY_CALLBACK}')); | ||
${code} | ||
`; | ||
return code; | ||
return { | ||
code: `await import("${VIRTUAL_ENTRY}").then(() => fetch('${READY_CALLBACK}'));${code}`, | ||
map: { | ||
mappings: "" | ||
} | ||
}; | ||
} | ||
@@ -1593,3 +1597,3 @@ return null; | ||
var import_pluginutils5 = __toModule(require("@rollup/pluginutils")); | ||
var VIRTUAL_ENTRY2 = "/@unocss/entry.css"; | ||
var VIRTUAL_ENTRY2 = "/@unocss-entry.css"; | ||
var PLACEHOLDER = "#--unocss--{--unocss:true}"; | ||
@@ -1599,2 +1603,3 @@ var PLACEHOLDER_RE = /#--unocss--\s*{\s*--unocss:\s*true;?\s*}/; | ||
const filter = (0, import_pluginutils5.createFilter)(config.include || defaultInclude, config.exclude || defaultExclude); | ||
let mainEntry; | ||
const tasks = []; | ||
@@ -1606,6 +1611,17 @@ return [ | ||
enforce: "pre", | ||
buildStart() { | ||
mainEntry = void 0; | ||
}, | ||
transform(code, id) { | ||
if (!filter(id)) | ||
return; | ||
tasks.push(scan(code, id)); | ||
if (filter(id)) | ||
tasks.push(scan(code, id)); | ||
if (mainEntry === id || mainEntry == null && !id.includes("node_modules/vite") && !id.endsWith(".html") && id.startsWith("/")) { | ||
mainEntry = id; | ||
return { | ||
code: `${code};import '${VIRTUAL_ENTRY2}';`, | ||
map: { | ||
mappings: "" | ||
} | ||
}; | ||
} | ||
return null; | ||
@@ -1620,9 +1636,2 @@ }, | ||
return PLACEHOLDER; | ||
}, | ||
transformIndexHtml: { | ||
enforce: "pre", | ||
transform(code, { path }) { | ||
tasks.push(scan(code, path)); | ||
return `${code}<script src="${VIRTUAL_ENTRY2}" type="module"><\/script>`; | ||
} | ||
} | ||
@@ -1638,3 +1647,5 @@ }, | ||
async generateBundle(options, bundle) { | ||
const keys = Object.keys(bundle).filter((i) => i.endsWith(".css")); | ||
const files = Object.keys(bundle).filter((i) => i.endsWith(".css")); | ||
if (!files.length) | ||
return; | ||
await Promise.all(tasks); | ||
@@ -1645,4 +1656,4 @@ const { css } = await uno.generate(tokens); | ||
return; | ||
for (const key of keys) { | ||
const chunk = bundle[key]; | ||
for (const file of files) { | ||
const chunk = bundle[file]; | ||
if (chunk.type === "asset" && typeof chunk.source === "string") { | ||
@@ -1649,0 +1660,0 @@ if (PLACEHOLDER_RE.test(chunk.source)) { |
{ | ||
"name": "@unocss/vite", | ||
"version": "0.1.3", | ||
"description": "", | ||
"keywords": [], | ||
"homepage": "https://github.com/antfu/unocss#readme", | ||
"bugs": { | ||
"url": "https://github.com/antfu/unocss/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/antfu/unocss.git" | ||
}, | ||
"funding": "https://github.com/sponsors/antfu", | ||
"license": "MIT", | ||
"author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@rollup/pluginutils": "^4.1.1", | ||
"@unocss/config": "0.1.3", | ||
"@unocss/core": "0.1.3", | ||
"@unocss/scope": "0.1.3", | ||
"nanoevents": "^6.0.2" | ||
}, | ||
"devDependencies": { | ||
"vite": "^2.6.12" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch src" | ||
} | ||
} | ||
"name": "@unocss/vite", | ||
"version": "0.1.4", | ||
"description": "", | ||
"keywords": [], | ||
"homepage": "https://github.com/antfu/unocss#readme", | ||
"bugs": { | ||
"url": "https://github.com/antfu/unocss/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/antfu/unocss.git" | ||
}, | ||
"funding": "https://github.com/sponsors/antfu", | ||
"license": "MIT", | ||
"author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@rollup/pluginutils": "^4.1.1", | ||
"@unocss/config": "0.1.4", | ||
"@unocss/core": "0.1.4", | ||
"@unocss/scope": "0.1.4", | ||
"nanoevents": "^6.0.2" | ||
}, | ||
"devDependencies": { | ||
"vite": "^2.6.12" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch src" | ||
} | ||
} |
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
98528
3374
+ Added@unocss/config@0.1.4(transitive)
+ Added@unocss/core@0.1.4(transitive)
+ Added@unocss/scope@0.1.4(transitive)
- Removed@unocss/config@0.1.3(transitive)
- Removed@unocss/core@0.1.3(transitive)
- Removed@unocss/scope@0.1.3(transitive)
Updated@unocss/config@0.1.4
Updated@unocss/core@0.1.4
Updated@unocss/scope@0.1.4