@unocss/vite 0.12.13 → 0.12.17
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 +14 -3
- package/dist/index.mjs +14 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ var import_config = __toModule(require("@unocss/config"));
|
|
|
76
76
|
var import_core = __toModule(require("@unocss/core"));
|
|
77
77
|
function createContext(configOrPath, defaults = {}) {
|
|
78
78
|
const { config = {}, filepath } = (0, import_config.loadConfig)(configOrPath);
|
|
79
|
+
let rawConfig = config;
|
|
79
80
|
const uno = (0, import_core.createGenerator)(config, defaults);
|
|
80
81
|
const invalidations = [];
|
|
81
82
|
const modules = new import_core.BetterMap();
|
|
@@ -95,7 +96,8 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
95
96
|
async function reloadConfig() {
|
|
96
97
|
if (!filepath)
|
|
97
98
|
return;
|
|
98
|
-
|
|
99
|
+
rawConfig = (0, import_config.loadConfig)(filepath).config;
|
|
100
|
+
uno.setConfig(rawConfig);
|
|
99
101
|
uno.config.envMode = "dev";
|
|
100
102
|
rollupFilter = (0, import_pluginutils.createFilter)(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
101
103
|
tokens.clear();
|
|
@@ -116,7 +118,9 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
116
118
|
reloadConfig,
|
|
117
119
|
uno,
|
|
118
120
|
extract,
|
|
119
|
-
config
|
|
121
|
+
get config() {
|
|
122
|
+
return rawConfig;
|
|
123
|
+
},
|
|
120
124
|
configFilepath: filepath
|
|
121
125
|
};
|
|
122
126
|
}
|
|
@@ -493,9 +497,16 @@ function VueScopedPlugin({ uno, config }) {
|
|
|
493
497
|
}
|
|
494
498
|
|
|
495
499
|
// src/config-hmr.ts
|
|
496
|
-
function ConfigHMRPlugin(
|
|
500
|
+
function ConfigHMRPlugin(ctx) {
|
|
501
|
+
const { uno, configFilepath, reloadConfig } = ctx;
|
|
497
502
|
return {
|
|
498
503
|
name: "unocss:config",
|
|
504
|
+
api: {
|
|
505
|
+
get config() {
|
|
506
|
+
if (!configFilepath)
|
|
507
|
+
return ctx.config;
|
|
508
|
+
}
|
|
509
|
+
},
|
|
499
510
|
configureServer(server) {
|
|
500
511
|
uno.config.envMode = "dev";
|
|
501
512
|
if (!configFilepath)
|
package/dist/index.mjs
CHANGED
|
@@ -42,6 +42,7 @@ import { loadConfig } from "@unocss/config";
|
|
|
42
42
|
import { BetterMap, createGenerator } from "@unocss/core";
|
|
43
43
|
function createContext(configOrPath, defaults = {}) {
|
|
44
44
|
const { config = {}, filepath } = loadConfig(configOrPath);
|
|
45
|
+
let rawConfig = config;
|
|
45
46
|
const uno = createGenerator(config, defaults);
|
|
46
47
|
const invalidations = [];
|
|
47
48
|
const modules = new BetterMap();
|
|
@@ -61,7 +62,8 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
61
62
|
async function reloadConfig() {
|
|
62
63
|
if (!filepath)
|
|
63
64
|
return;
|
|
64
|
-
|
|
65
|
+
rawConfig = loadConfig(filepath).config;
|
|
66
|
+
uno.setConfig(rawConfig);
|
|
65
67
|
uno.config.envMode = "dev";
|
|
66
68
|
rollupFilter = createFilter(config.include || defaultInclude, config.exclude || defaultExclude);
|
|
67
69
|
tokens.clear();
|
|
@@ -82,7 +84,9 @@ function createContext(configOrPath, defaults = {}) {
|
|
|
82
84
|
reloadConfig,
|
|
83
85
|
uno,
|
|
84
86
|
extract,
|
|
85
|
-
config
|
|
87
|
+
get config() {
|
|
88
|
+
return rawConfig;
|
|
89
|
+
},
|
|
86
90
|
configFilepath: filepath
|
|
87
91
|
};
|
|
88
92
|
}
|
|
@@ -459,9 +463,16 @@ function VueScopedPlugin({ uno, config }) {
|
|
|
459
463
|
}
|
|
460
464
|
|
|
461
465
|
// src/config-hmr.ts
|
|
462
|
-
function ConfigHMRPlugin(
|
|
466
|
+
function ConfigHMRPlugin(ctx) {
|
|
467
|
+
const { uno, configFilepath, reloadConfig } = ctx;
|
|
463
468
|
return {
|
|
464
469
|
name: "unocss:config",
|
|
470
|
+
api: {
|
|
471
|
+
get config() {
|
|
472
|
+
if (!configFilepath)
|
|
473
|
+
return ctx.config;
|
|
474
|
+
}
|
|
475
|
+
},
|
|
465
476
|
configureServer(server) {
|
|
466
477
|
uno.config.envMode = "dev";
|
|
467
478
|
if (!configFilepath)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.17",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@rollup/pluginutils": "^4.1.1",
|
|
38
|
-
"@unocss/config": "0.12.
|
|
39
|
-
"@unocss/core": "0.12.
|
|
40
|
-
"@unocss/inspector": "0.12.
|
|
41
|
-
"@unocss/scope": "0.12.
|
|
38
|
+
"@unocss/config": "0.12.17",
|
|
39
|
+
"@unocss/core": "0.12.17",
|
|
40
|
+
"@unocss/inspector": "0.12.17",
|
|
41
|
+
"@unocss/scope": "0.12.17"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"vite": "^2.6.14"
|