@unocss/webpack
Advanced tools
Comparing version 0.12.18 to 0.13.0
@@ -75,9 +75,21 @@ var __create = Object.create; | ||
function createContext(configOrPath, defaults = {}) { | ||
const { config = {}, filepath } = (0, import_config.loadConfig)(configOrPath); | ||
let rawConfig = config; | ||
const uno = (0, import_core.createGenerator)(config, defaults); | ||
const loadConfig = (0, import_config.createConfigLoader)(configOrPath); | ||
let rawConfig = {}; | ||
const uno = (0, import_core.createGenerator)(rawConfig, defaults); | ||
let rollupFilter = (0, import_pluginutils.createFilter)(defaultInclude, defaultExclude); | ||
const invalidations = []; | ||
const modules = new import_core.BetterMap(); | ||
const tokens = new Set(); | ||
let rollupFilter = (0, import_pluginutils.createFilter)(config.include || defaultInclude, config.exclude || defaultExclude); | ||
const ready = reloadConfig(); | ||
async function reloadConfig() { | ||
const result = await loadConfig(); | ||
rawConfig = result.config; | ||
uno.setConfig(rawConfig); | ||
uno.config.envMode = "dev"; | ||
rollupFilter = (0, import_pluginutils.createFilter)(rawConfig.include || defaultInclude, rawConfig.exclude || defaultExclude); | ||
tokens.clear(); | ||
await Promise.all(modules.map((code, id) => uno.applyExtractors(code, id, tokens))); | ||
invalidate(); | ||
return result; | ||
} | ||
function invalidate() { | ||
@@ -94,17 +106,11 @@ invalidations.forEach((cb) => cb()); | ||
} | ||
async function reloadConfig() { | ||
if (!filepath) | ||
return; | ||
rawConfig = (0, import_config.loadConfig)(filepath).config; | ||
uno.setConfig(rawConfig); | ||
uno.config.envMode = "dev"; | ||
rollupFilter = (0, import_pluginutils.createFilter)(config.include || defaultInclude, config.exclude || defaultExclude); | ||
tokens.clear(); | ||
await Promise.all(modules.map((code, id) => uno.applyExtractors(code, id, tokens))); | ||
invalidate(); | ||
} | ||
const filter = (code, id) => { | ||
return code.includes(INCLUDE_COMMENT) || rollupFilter(id); | ||
}; | ||
async function getConfig() { | ||
await ready; | ||
return rawConfig; | ||
} | ||
return { | ||
ready, | ||
tokens, | ||
@@ -120,6 +126,3 @@ modules, | ||
extract, | ||
get config() { | ||
return rawConfig; | ||
}, | ||
configFilepath: filepath | ||
getConfig | ||
}; | ||
@@ -126,0 +129,0 @@ } |
{ | ||
"name": "@unocss/webpack", | ||
"version": "0.12.18", | ||
"version": "0.13.0", | ||
"description": "The Webpack plugin for UnoCSS", | ||
@@ -37,4 +37,4 @@ "keywords": [ | ||
"@rollup/pluginutils": "^4.1.1", | ||
"@unocss/config": "0.12.18", | ||
"@unocss/core": "0.12.18", | ||
"@unocss/config": "0.13.0", | ||
"@unocss/core": "0.13.0", | ||
"unplugin": "^0.2.21", | ||
@@ -41,0 +41,0 @@ "webpack-sources": "^3.2.2" |
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
16706
403
+ Added@antfu/utils@0.3.0(transitive)
+ Added@types/throttle-debounce@2.1.0(transitive)
+ Added@unocss/config@0.13.0(transitive)
+ Added@unocss/core@0.13.0(transitive)
+ Addeddefu@5.0.1(transitive)
+ Addedjiti@1.21.6(transitive)
+ Addedunconfig@0.2.2(transitive)
- Removed@isaacs/cliui@8.0.2(transitive)
- Removed@pkgjs/parseargs@0.11.0(transitive)
- Removed@unocss/config@0.12.18(transitive)
- Removed@unocss/core@0.12.18(transitive)
- Removedansi-regex@5.0.16.1.0(transitive)
- Removedansi-styles@4.3.06.2.1(transitive)
- Removedany-promise@1.3.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcommander@4.1.1(transitive)
- Removedcross-spawn@7.0.5(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@8.0.09.2.2(transitive)
- Removedforeground-child@3.3.0(transitive)
- Removedglob@10.4.5(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjackspeak@3.4.3(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedlru-cache@10.4.3(transitive)
- Removedminimatch@9.0.5(transitive)
- Removedminipass@7.1.2(transitive)
- Removedmz@2.7.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpackage-json-from-dist@1.0.1(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpath-scurry@1.11.1(transitive)
- Removedpirates@4.0.6(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@4.1.0(transitive)
- Removedstring-width@4.2.35.1.2(transitive)
- Removedstrip-ansi@6.0.17.1.0(transitive)
- Removedsucrase@3.35.0(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
- Removedts-interface-checker@0.1.13(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwrap-ansi@7.0.08.1.0(transitive)
Updated@unocss/config@0.13.0
Updated@unocss/core@0.13.0