@unocss/webpack 0.31.8 → 0.31.12
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.cjs +16 -5
- package/dist/index.mjs +17 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -49,16 +49,16 @@ const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
|
49
49
|
|
|
50
50
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {
|
|
51
51
|
}) {
|
|
52
|
-
|
|
52
|
+
let root = process.cwd();
|
|
53
53
|
let rawConfig = {};
|
|
54
54
|
const uno = core.createGenerator(rawConfig, defaults);
|
|
55
55
|
let rollupFilter = pluginutils.createFilter(defaultInclude, defaultExclude);
|
|
56
56
|
const invalidations = [];
|
|
57
57
|
const modules = new core.BetterMap();
|
|
58
58
|
const tokens = /* @__PURE__ */ new Set();
|
|
59
|
-
|
|
59
|
+
let ready = reloadConfig();
|
|
60
60
|
async function reloadConfig() {
|
|
61
|
-
const result = await loadConfig();
|
|
61
|
+
const result = await config.loadConfig(root, configOrPath, extraConfigSources);
|
|
62
62
|
resolveConfigResult(result);
|
|
63
63
|
rawConfig = result.config;
|
|
64
64
|
uno.setConfig(rawConfig);
|
|
@@ -69,6 +69,13 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
69
69
|
invalidate();
|
|
70
70
|
return result;
|
|
71
71
|
}
|
|
72
|
+
async function updateRoot(newRoot) {
|
|
73
|
+
if (newRoot !== root) {
|
|
74
|
+
root = newRoot;
|
|
75
|
+
ready = reloadConfig();
|
|
76
|
+
}
|
|
77
|
+
return await ready;
|
|
78
|
+
}
|
|
72
79
|
function invalidate() {
|
|
73
80
|
invalidations.forEach((cb) => cb());
|
|
74
81
|
}
|
|
@@ -88,7 +95,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
88
95
|
return rawConfig;
|
|
89
96
|
}
|
|
90
97
|
return {
|
|
91
|
-
ready
|
|
98
|
+
get ready() {
|
|
99
|
+
return ready;
|
|
100
|
+
},
|
|
92
101
|
tokens,
|
|
93
102
|
modules,
|
|
94
103
|
invalidate,
|
|
@@ -99,7 +108,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
99
108
|
reloadConfig,
|
|
100
109
|
uno,
|
|
101
110
|
extract,
|
|
102
|
-
getConfig
|
|
111
|
+
getConfig,
|
|
112
|
+
root,
|
|
113
|
+
updateRoot
|
|
103
114
|
};
|
|
104
115
|
}
|
|
105
116
|
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createUnplugin } from 'unplugin';
|
|
|
2
2
|
import WebpackSources from 'webpack-sources';
|
|
3
3
|
import 'crypto';
|
|
4
4
|
import { createFilter } from '@rollup/pluginutils';
|
|
5
|
-
import {
|
|
5
|
+
import { loadConfig } from '@unocss/config';
|
|
6
6
|
import { createGenerator, BetterMap } from '@unocss/core';
|
|
7
7
|
|
|
8
8
|
function getPath(id) {
|
|
@@ -41,16 +41,16 @@ const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
|
41
41
|
|
|
42
42
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {
|
|
43
43
|
}) {
|
|
44
|
-
|
|
44
|
+
let root = process.cwd();
|
|
45
45
|
let rawConfig = {};
|
|
46
46
|
const uno = createGenerator(rawConfig, defaults);
|
|
47
47
|
let rollupFilter = createFilter(defaultInclude, defaultExclude);
|
|
48
48
|
const invalidations = [];
|
|
49
49
|
const modules = new BetterMap();
|
|
50
50
|
const tokens = /* @__PURE__ */ new Set();
|
|
51
|
-
|
|
51
|
+
let ready = reloadConfig();
|
|
52
52
|
async function reloadConfig() {
|
|
53
|
-
const result = await loadConfig();
|
|
53
|
+
const result = await loadConfig(root, configOrPath, extraConfigSources);
|
|
54
54
|
resolveConfigResult(result);
|
|
55
55
|
rawConfig = result.config;
|
|
56
56
|
uno.setConfig(rawConfig);
|
|
@@ -61,6 +61,13 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
61
61
|
invalidate();
|
|
62
62
|
return result;
|
|
63
63
|
}
|
|
64
|
+
async function updateRoot(newRoot) {
|
|
65
|
+
if (newRoot !== root) {
|
|
66
|
+
root = newRoot;
|
|
67
|
+
ready = reloadConfig();
|
|
68
|
+
}
|
|
69
|
+
return await ready;
|
|
70
|
+
}
|
|
64
71
|
function invalidate() {
|
|
65
72
|
invalidations.forEach((cb) => cb());
|
|
66
73
|
}
|
|
@@ -80,7 +87,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
80
87
|
return rawConfig;
|
|
81
88
|
}
|
|
82
89
|
return {
|
|
83
|
-
ready
|
|
90
|
+
get ready() {
|
|
91
|
+
return ready;
|
|
92
|
+
},
|
|
84
93
|
tokens,
|
|
85
94
|
modules,
|
|
86
95
|
invalidate,
|
|
@@ -91,7 +100,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
91
100
|
reloadConfig,
|
|
92
101
|
uno,
|
|
93
102
|
extract,
|
|
94
|
-
getConfig
|
|
103
|
+
getConfig,
|
|
104
|
+
root,
|
|
105
|
+
updateRoot
|
|
95
106
|
};
|
|
96
107
|
}
|
|
97
108
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.12",
|
|
4
4
|
"description": "The Webpack plugin for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@rollup/pluginutils": "^4.2.1",
|
|
40
|
-
"@unocss/config": "0.31.
|
|
41
|
-
"@unocss/core": "0.31.
|
|
40
|
+
"@unocss/config": "0.31.12",
|
|
41
|
+
"@unocss/core": "0.31.12",
|
|
42
42
|
"unplugin": "^0.6.2",
|
|
43
43
|
"webpack-sources": "^3.2.3"
|
|
44
44
|
},
|