@unocss/webpack 0.12.12 → 0.12.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -5
- package/dist/index.mjs +11 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -73,6 +73,7 @@ var import_config = __toModule(require("@unocss/config"));
|
|
|
73
73
|
var import_core = __toModule(require("@unocss/core"));
|
|
74
74
|
function createContext(configOrPath, defaults = {}) {
|
|
75
75
|
const { config = {}, filepath } = (0, import_config.loadConfig)(configOrPath);
|
|
76
|
+
let rawConfig = config;
|
|
76
77
|
const uno = (0, import_core.createGenerator)(config, defaults);
|
|
77
78
|
const invalidations = [];
|
|
78
79
|
const modules = new import_core.BetterMap();
|
|
@@ -81,16 +82,19 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
81
82
|
function invalidate() {
|
|
82
83
|
invalidations.forEach((cb) => cb());
|
|
83
84
|
}
|
|
84
|
-
async function
|
|
85
|
+
async function extract(code, id) {
|
|
85
86
|
if (id)
|
|
86
87
|
modules.set(id, code);
|
|
88
|
+
const len = tokens.size;
|
|
87
89
|
await uno.applyExtractors(code, id, tokens);
|
|
88
|
-
|
|
90
|
+
if (tokens.size > len)
|
|
91
|
+
invalidate();
|
|
89
92
|
}
|
|
90
93
|
async function reloadConfig() {
|
|
91
94
|
if (!filepath)
|
|
92
95
|
return;
|
|
93
|
-
|
|
96
|
+
rawConfig = (0, import_config.loadConfig)(filepath).config;
|
|
97
|
+
uno.setConfig(rawConfig);
|
|
94
98
|
uno.config.envMode = "dev";
|
|
95
99
|
rollupFilter = (0, import_pluginutils.createFilter)(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
96
100
|
tokens.clear();
|
|
@@ -110,8 +114,10 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
110
114
|
filter,
|
|
111
115
|
reloadConfig,
|
|
112
116
|
uno,
|
|
113
|
-
extract
|
|
114
|
-
config
|
|
117
|
+
extract,
|
|
118
|
+
get config() {
|
|
119
|
+
return rawConfig;
|
|
120
|
+
},
|
|
115
121
|
configFilepath: filepath
|
|
116
122
|
};
|
|
117
123
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -45,6 +45,7 @@ import { loadConfig } from "@unocss/config";
|
|
|
45
45
|
import { BetterMap, createGenerator } from "@unocss/core";
|
|
46
46
|
function createContext(configOrPath, defaults = {}) {
|
|
47
47
|
const { config = {}, filepath } = loadConfig(configOrPath);
|
|
48
|
+
let rawConfig = config;
|
|
48
49
|
const uno = createGenerator(config, defaults);
|
|
49
50
|
const invalidations = [];
|
|
50
51
|
const modules = new BetterMap();
|
|
@@ -53,16 +54,19 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
53
54
|
function invalidate() {
|
|
54
55
|
invalidations.forEach((cb) => cb());
|
|
55
56
|
}
|
|
56
|
-
async function
|
|
57
|
+
async function extract(code, id) {
|
|
57
58
|
if (id)
|
|
58
59
|
modules.set(id, code);
|
|
60
|
+
const len = tokens.size;
|
|
59
61
|
await uno.applyExtractors(code, id, tokens);
|
|
60
|
-
|
|
62
|
+
if (tokens.size > len)
|
|
63
|
+
invalidate();
|
|
61
64
|
}
|
|
62
65
|
async function reloadConfig() {
|
|
63
66
|
if (!filepath)
|
|
64
67
|
return;
|
|
65
|
-
|
|
68
|
+
rawConfig = loadConfig(filepath).config;
|
|
69
|
+
uno.setConfig(rawConfig);
|
|
66
70
|
uno.config.envMode = "dev";
|
|
67
71
|
rollupFilter = createFilter(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
68
72
|
tokens.clear();
|
|
@@ -82,8 +86,10 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
82
86
|
filter,
|
|
83
87
|
reloadConfig,
|
|
84
88
|
uno,
|
|
85
|
-
extract
|
|
86
|
-
config
|
|
89
|
+
extract,
|
|
90
|
+
get config() {
|
|
91
|
+
return rawConfig;
|
|
92
|
+
},
|
|
87
93
|
configFilepath: filepath
|
|
88
94
|
};
|
|
89
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.16",
|
|
4
4
|
"description": "The Webpack plugin for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@rollup/pluginutils": "^4.1.1",
|
|
37
|
-
"@unocss/config": "0.12.
|
|
38
|
-
"@unocss/core": "0.12.
|
|
37
|
+
"@unocss/config": "0.12.16",
|
|
38
|
+
"@unocss/core": "0.12.16",
|
|
39
39
|
"unplugin": "^0.2.21",
|
|
40
40
|
"webpack-sources": "^3.2.2"
|
|
41
41
|
},
|