@unocss/vite 0.32.9 → 0.32.13
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 +14 -9
- package/dist/index.mjs +14 -9
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const UnocssInspector = require('@unocss/inspector');
|
|
6
|
-
const pluginutils = require('@rollup/pluginutils');
|
|
7
|
-
const config = require('@unocss/config');
|
|
8
|
-
const core = require('@unocss/core');
|
|
9
6
|
const crypto = require('crypto');
|
|
7
|
+
const core = require('@unocss/core');
|
|
8
|
+
const pluginutils = require('@rollup/pluginutils');
|
|
10
9
|
const MagicString = require('magic-string');
|
|
11
10
|
const fs = require('fs');
|
|
12
11
|
const path = require('path');
|
|
13
12
|
const url = require('url');
|
|
13
|
+
const config = require('@unocss/config');
|
|
14
14
|
|
|
15
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
16
16
|
|
|
@@ -18,8 +18,7 @@ const UnocssInspector__default = /*#__PURE__*/_interopDefaultLegacy(UnocssInspec
|
|
|
18
18
|
const MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
|
19
19
|
const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
const defaultExclude = [regexCssId];
|
|
21
|
+
const defaultExclude = [core.cssIdRE];
|
|
23
22
|
const defaultInclude = [/\.vue$/, /\.vue\?vue/, /\.svelte$/, /\.[jt]sx$/, /\.mdx?$/, /\.astro$/, /\.elm$/];
|
|
24
23
|
|
|
25
24
|
const VIRTUAL_ENTRY_ALIAS = [
|
|
@@ -51,6 +50,7 @@ function getHashPlaceholder(hash) {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
53
|
+
const IGNORE_COMMENT = "@unocss-ignore";
|
|
54
54
|
const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
55
55
|
|
|
56
56
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {
|
|
@@ -94,6 +94,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
94
94
|
invalidate();
|
|
95
95
|
}
|
|
96
96
|
const filter = (code, id) => {
|
|
97
|
+
if (code.includes(IGNORE_COMMENT))
|
|
98
|
+
return false;
|
|
97
99
|
return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id);
|
|
98
100
|
};
|
|
99
101
|
async function getConfig() {
|
|
@@ -123,6 +125,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
123
125
|
function getPath(id) {
|
|
124
126
|
return id.replace(/\?.*$/, "");
|
|
125
127
|
}
|
|
128
|
+
|
|
129
|
+
function getHash(input, length = 8) {
|
|
130
|
+
return crypto.createHash("sha256").update(input).digest("hex").slice(0, length);
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
function replaceAsync(string, searchValue, replacer) {
|
|
127
134
|
try {
|
|
128
135
|
if (typeof replacer === "function") {
|
|
@@ -186,10 +193,6 @@ function ChunkModeBuildPlugin({ uno, filter }) {
|
|
|
186
193
|
};
|
|
187
194
|
}
|
|
188
195
|
|
|
189
|
-
function getHash(input, length = 8) {
|
|
190
|
-
return crypto.createHash("sha256").update(input).digest("hex").slice(0, length);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
196
|
function GlobalModeBuildPlugin({ uno, ready, extract, tokens, modules, filter, getConfig }) {
|
|
194
197
|
const vfsLayerMap = /* @__PURE__ */ new Map();
|
|
195
198
|
let tasks = [];
|
|
@@ -689,6 +692,8 @@ function ConfigHMRPlugin(ctx) {
|
|
|
689
692
|
|
|
690
693
|
function initTransformerPlugins(ctx) {
|
|
691
694
|
async function applyTransformers(code, id, enforce) {
|
|
695
|
+
if (code.includes(IGNORE_COMMENT))
|
|
696
|
+
return;
|
|
692
697
|
const transformers = (ctx.uno.config.transformers || []).filter((i) => i.enforce === enforce);
|
|
693
698
|
if (!transformers.length)
|
|
694
699
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import UnocssInspector from '@unocss/inspector';
|
|
2
|
-
import { createFilter } from '@rollup/pluginutils';
|
|
3
|
-
import { loadConfig } from '@unocss/config';
|
|
4
|
-
import { createGenerator, BetterMap, toEscapedSelector } from '@unocss/core';
|
|
5
2
|
import { createHash } from 'crypto';
|
|
3
|
+
import { cssIdRE, createGenerator, BetterMap, toEscapedSelector } from '@unocss/core';
|
|
4
|
+
import { createFilter } from '@rollup/pluginutils';
|
|
6
5
|
import MagicString from 'magic-string';
|
|
7
6
|
import fs from 'fs';
|
|
8
7
|
import { resolve, dirname } from 'path';
|
|
9
8
|
import { fileURLToPath } from 'url';
|
|
9
|
+
import { loadConfig } from '@unocss/config';
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const defaultExclude = [regexCssId];
|
|
11
|
+
const defaultExclude = [cssIdRE];
|
|
13
12
|
const defaultInclude = [/\.vue$/, /\.vue\?vue/, /\.svelte$/, /\.[jt]sx$/, /\.mdx?$/, /\.astro$/, /\.elm$/];
|
|
14
13
|
|
|
15
14
|
const VIRTUAL_ENTRY_ALIAS = [
|
|
@@ -41,6 +40,7 @@ function getHashPlaceholder(hash) {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
43
|
+
const IGNORE_COMMENT = "@unocss-ignore";
|
|
44
44
|
const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
45
45
|
|
|
46
46
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {
|
|
@@ -84,6 +84,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
84
84
|
invalidate();
|
|
85
85
|
}
|
|
86
86
|
const filter = (code, id) => {
|
|
87
|
+
if (code.includes(IGNORE_COMMENT))
|
|
88
|
+
return false;
|
|
87
89
|
return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id);
|
|
88
90
|
};
|
|
89
91
|
async function getConfig() {
|
|
@@ -113,6 +115,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
113
115
|
function getPath(id) {
|
|
114
116
|
return id.replace(/\?.*$/, "");
|
|
115
117
|
}
|
|
118
|
+
|
|
119
|
+
function getHash(input, length = 8) {
|
|
120
|
+
return createHash("sha256").update(input).digest("hex").slice(0, length);
|
|
121
|
+
}
|
|
122
|
+
|
|
116
123
|
function replaceAsync(string, searchValue, replacer) {
|
|
117
124
|
try {
|
|
118
125
|
if (typeof replacer === "function") {
|
|
@@ -176,10 +183,6 @@ function ChunkModeBuildPlugin({ uno, filter }) {
|
|
|
176
183
|
};
|
|
177
184
|
}
|
|
178
185
|
|
|
179
|
-
function getHash(input, length = 8) {
|
|
180
|
-
return createHash("sha256").update(input).digest("hex").slice(0, length);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
186
|
function GlobalModeBuildPlugin({ uno, ready, extract, tokens, modules, filter, getConfig }) {
|
|
184
187
|
const vfsLayerMap = /* @__PURE__ */ new Map();
|
|
185
188
|
let tasks = [];
|
|
@@ -679,6 +682,8 @@ function ConfigHMRPlugin(ctx) {
|
|
|
679
682
|
|
|
680
683
|
function initTransformerPlugins(ctx) {
|
|
681
684
|
async function applyTransformers(code, id, enforce) {
|
|
685
|
+
if (code.includes(IGNORE_COMMENT))
|
|
686
|
+
return;
|
|
682
687
|
const transformers = (ctx.uno.config.transformers || []).filter((i) => i.enforce === enforce);
|
|
683
688
|
if (!transformers.length)
|
|
684
689
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.13",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -43,14 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@rollup/pluginutils": "^4.2.1",
|
|
46
|
-
"@unocss/config": "0.32.
|
|
47
|
-
"@unocss/core": "0.32.
|
|
48
|
-
"@unocss/inspector": "0.32.
|
|
49
|
-
"@unocss/scope": "0.32.
|
|
50
|
-
"@unocss/transformer-directives": "0.32.
|
|
46
|
+
"@unocss/config": "0.32.13",
|
|
47
|
+
"@unocss/core": "0.32.13",
|
|
48
|
+
"@unocss/inspector": "0.32.13",
|
|
49
|
+
"@unocss/scope": "0.32.13",
|
|
50
|
+
"@unocss/transformer-directives": "0.32.13",
|
|
51
51
|
"magic-string": "^0.26.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
+
"@unocss/shared-integration": "0.32.13",
|
|
54
55
|
"vite": "^2.9.6"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|