@unocss/svelte-scoped 0.60.4 → 0.61.2
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/vite.mjs +17 -18
- package/package.json +4 -4
package/dist/vite.mjs
CHANGED
|
@@ -8,7 +8,6 @@ import { dirname, resolve } from 'node:path';
|
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import MagicString from 'magic-string';
|
|
10
10
|
import remapping from '@ampproject/remapping';
|
|
11
|
-
import 'node:crypto';
|
|
12
11
|
import 'css-tree';
|
|
13
12
|
|
|
14
13
|
function PassPreprocessToSveltePlugin(context, options = {}) {
|
|
@@ -166,6 +165,22 @@ function hash(str) {
|
|
|
166
165
|
}
|
|
167
166
|
return `00000${(hval >>> 0).toString(36)}`.slice(-6);
|
|
168
167
|
}
|
|
168
|
+
function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
|
|
169
|
+
for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) {
|
|
170
|
+
if (item != null) {
|
|
171
|
+
const matched = item[0];
|
|
172
|
+
const withHashKey = `${keyFlag}${hash(matched)}`;
|
|
173
|
+
map.set(withHashKey, matched);
|
|
174
|
+
code = code.replace(matched, withHashKey);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return code;
|
|
178
|
+
}
|
|
179
|
+
function restoreSkipCode(code, map) {
|
|
180
|
+
for (const [withHashKey, matched] of map.entries())
|
|
181
|
+
code = code.replaceAll(withHashKey, matched);
|
|
182
|
+
return code;
|
|
183
|
+
}
|
|
169
184
|
|
|
170
185
|
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
171
186
|
if (original.includes(IGNORE_COMMENT))
|
|
@@ -175,7 +190,7 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
175
190
|
return;
|
|
176
191
|
const skipMap = /* @__PURE__ */ new Map();
|
|
177
192
|
let code = original;
|
|
178
|
-
let s = new MagicString(transformSkipCode(code, skipMap));
|
|
193
|
+
let s = new MagicString(transformSkipCode(code, skipMap, SKIP_COMMENT_RE, "@unocss-skip-placeholder-"));
|
|
179
194
|
const maps = [];
|
|
180
195
|
for (const t of transformers) {
|
|
181
196
|
if (t.idFilter) {
|
|
@@ -201,22 +216,6 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
201
216
|
};
|
|
202
217
|
}
|
|
203
218
|
}
|
|
204
|
-
function transformSkipCode(code, map) {
|
|
205
|
-
for (const item of Array.from(code.matchAll(SKIP_COMMENT_RE))) {
|
|
206
|
-
if (item != null) {
|
|
207
|
-
const matched = item[0];
|
|
208
|
-
const withHashKey = `@unocss-skip-placeholder-${hash(matched)}`;
|
|
209
|
-
map.set(withHashKey, matched);
|
|
210
|
-
code = code.replace(matched, withHashKey);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return code;
|
|
214
|
-
}
|
|
215
|
-
function restoreSkipCode(code, map) {
|
|
216
|
-
for (const [withHashKey, matched] of map.entries())
|
|
217
|
-
code = code.replace(withHashKey, matched);
|
|
218
|
-
return code;
|
|
219
|
-
}
|
|
220
219
|
|
|
221
220
|
const svelteIdRE = /[&?]svelte/;
|
|
222
221
|
function createCssTransformerPlugins(context, cssTransformers) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/svelte-scoped",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.61.2",
|
|
5
5
|
"description": "Use UnoCSS in a modular fashion with styles being stored only in the Svelte component they are used in: Vite plugin for apps, Svelte preprocessor for component libraries",
|
|
6
6
|
"author": "Jacob Bowdoin",
|
|
7
7
|
"license": "MIT",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"css-tree": "^2.3.1",
|
|
54
54
|
"magic-string": "^0.30.10",
|
|
55
|
-
"@unocss/
|
|
56
|
-
"@unocss/
|
|
55
|
+
"@unocss/config": "0.61.2",
|
|
56
|
+
"@unocss/reset": "0.61.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"prettier-plugin-svelte": "^2.10.1",
|
|
60
|
-
"svelte": "^4.2.
|
|
60
|
+
"svelte": "^4.2.18"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "unbuild",
|