@unocss/svelte-scoped 66.6.6 → 66.6.8
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/{preprocess-twOgJvD9.d.mts → preprocess-BolxGJ9J.d.mts} +7 -0
- package/dist/{preprocess-smYe4zo2.mjs → preprocess-CZVi4cj2.mjs} +10 -28
- package/dist/preprocess.d.mts +1 -1
- package/dist/preprocess.mjs +2 -3
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +13 -30
- package/package.json +9 -9
|
@@ -25,6 +25,13 @@ interface TransformClassesOptions {
|
|
|
25
25
|
* Used to generate hash for compiled class names
|
|
26
26
|
*/
|
|
27
27
|
hashFn?: (str: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Hash safelist classes (including shortcuts in the safelist) instead of passing them through as-is.
|
|
30
|
+
* When false (default), safelist classes are left unhashed so they match the globally generated safelist CSS.
|
|
31
|
+
* Set to true to restore the legacy behavior where shortcut classes in the safelist were still hashed.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
hashSafelistClasses?: boolean;
|
|
28
35
|
}
|
|
29
36
|
interface TransformApplyOptions {
|
|
30
37
|
/**
|
|
@@ -6,7 +6,6 @@ import MagicString from "magic-string";
|
|
|
6
6
|
import * as acorn from "acorn";
|
|
7
7
|
import { walk } from "zimmerframe";
|
|
8
8
|
import { clone, generate, parse, walk as walk$1 } from "css-tree";
|
|
9
|
-
|
|
10
9
|
//#region src/_preprocess/transformClasses/addGeneratedStyles.ts
|
|
11
10
|
const actualStylesTagWithCapturedDirectivesRE = new RegExp(/(?<!<!--\s*)/.source + /<style([^>]*)>[\s\S]*?<\/style\s*>/.source, "g");
|
|
12
11
|
const captureOpeningStyleTagWithAttributesRE = /(<style[^>]*>)/;
|
|
@@ -14,7 +13,6 @@ function addGeneratedStylesIntoStyleBlock(code, styles) {
|
|
|
14
13
|
if (code.match(actualStylesTagWithCapturedDirectivesRE)) return code.replace(captureOpeningStyleTagWithAttributesRE, `$1${styles}`);
|
|
15
14
|
return `${code}\n<style>${styles}</style>`;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
17
|
//#region src/_preprocess/transformClasses/findClasses.ts
|
|
20
18
|
const classesRE$1 = /class=(["'`])([\s\S]*?)\1/g;
|
|
@@ -105,7 +103,6 @@ function parseMatchesWithAcorn(matches, code) {
|
|
|
105
103
|
return classes;
|
|
106
104
|
}).filter(hasBody);
|
|
107
105
|
}
|
|
108
|
-
|
|
109
106
|
//#endregion
|
|
110
107
|
//#region src/_preprocess/transformClasses/hash.ts
|
|
111
108
|
function hash(str) {
|
|
@@ -118,7 +115,6 @@ function hash(str) {
|
|
|
118
115
|
}
|
|
119
116
|
return `00000${(hval >>> 0).toString(36)}`.slice(-6);
|
|
120
117
|
}
|
|
121
|
-
|
|
122
118
|
//#endregion
|
|
123
119
|
//#region src/_preprocess/transformClasses/generateClassName.ts
|
|
124
120
|
function generateClassName(body, options, filename) {
|
|
@@ -126,29 +122,30 @@ function generateClassName(body, options, filename) {
|
|
|
126
122
|
if (combine) return `${classPrefix}${hashFn(body + filename)}`;
|
|
127
123
|
else return `_${body}_${hashFn(filename)}`;
|
|
128
124
|
}
|
|
129
|
-
|
|
130
125
|
//#endregion
|
|
131
126
|
//#region src/_preprocess/transformClasses/isShortcut.ts
|
|
132
127
|
function isShortcut(token, shortcuts) {
|
|
133
128
|
return shortcuts.some((s) => s[0] === token);
|
|
134
129
|
}
|
|
135
|
-
|
|
136
130
|
//#endregion
|
|
137
131
|
//#region src/_preprocess/transformClasses/needsGenerated.ts
|
|
138
132
|
async function needsGenerated(token, uno) {
|
|
139
133
|
if (uno.config.safelist.includes(token)) return false;
|
|
140
134
|
return !!await uno.parseToken(token);
|
|
141
135
|
}
|
|
142
|
-
|
|
143
136
|
//#endregion
|
|
144
137
|
//#region src/_preprocess/transformClasses/sortClassesIntoCategories.ts
|
|
145
138
|
async function sortClassesIntoCategories(body, options, uno, filename) {
|
|
146
|
-
const { combine = true } = options;
|
|
139
|
+
const { combine = true, hashSafelistClasses = false } = options;
|
|
147
140
|
const rulesToGenerate = {};
|
|
148
141
|
const ignore = [];
|
|
149
142
|
const classes = body.trim().split(/\s+/);
|
|
150
143
|
const knownClassesToCombine = [];
|
|
151
144
|
for (const token of classes) {
|
|
145
|
+
if (!hashSafelistClasses && uno.config.safelist.includes(token)) {
|
|
146
|
+
ignore.push(token);
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
152
149
|
if (!(isShortcut(token, uno.config.shortcuts) || await needsGenerated(token, uno))) {
|
|
153
150
|
ignore.push(token);
|
|
154
151
|
continue;
|
|
@@ -168,7 +165,6 @@ async function sortClassesIntoCategories(body, options, uno, filename) {
|
|
|
168
165
|
ignore
|
|
169
166
|
};
|
|
170
167
|
}
|
|
171
|
-
|
|
172
168
|
//#endregion
|
|
173
169
|
//#region src/_preprocess/transformClasses/processExpressions.ts
|
|
174
170
|
const expressionsRE = /\S*\{[^{}]+\}\S*/g;
|
|
@@ -195,7 +191,6 @@ async function processExpressions(body, options, uno, filename) {
|
|
|
195
191
|
restOfBody
|
|
196
192
|
};
|
|
197
193
|
}
|
|
198
|
-
|
|
199
194
|
//#endregion
|
|
200
195
|
//#region src/_preprocess/transformClasses/processClassBody.ts
|
|
201
196
|
async function processClassBody({ body, start, end }, options, uno, filename) {
|
|
@@ -215,7 +210,6 @@ async function processClassBody({ body, start, end }, options, uno, filename) {
|
|
|
215
210
|
}
|
|
216
211
|
};
|
|
217
212
|
}
|
|
218
|
-
|
|
219
213
|
//#endregion
|
|
220
214
|
//#region src/_preprocess/transformClasses/processDirective.ts
|
|
221
215
|
async function processDirective({ body: token, start, end, type }, options, uno, filename) {
|
|
@@ -231,7 +225,6 @@ async function processDirective({ body: token, start, end, type }, options, uno,
|
|
|
231
225
|
}
|
|
232
226
|
};
|
|
233
227
|
}
|
|
234
|
-
|
|
235
228
|
//#endregion
|
|
236
229
|
//#region src/_preprocess/transformClasses/processClsx.ts
|
|
237
230
|
async function processClsx(cls, options, uno, filename) {
|
|
@@ -261,7 +254,6 @@ async function processClsx(cls, options, uno, filename) {
|
|
|
261
254
|
}
|
|
262
255
|
}
|
|
263
256
|
}
|
|
264
|
-
|
|
265
257
|
//#endregion
|
|
266
258
|
//#region src/_preprocess/transformClasses/processClasses.ts
|
|
267
259
|
async function processClasses(classes, options, uno, filename) {
|
|
@@ -281,14 +273,12 @@ async function processClass(foundClass, options, uno, filename) {
|
|
|
281
273
|
if (foundClass.type === "clsxObject" || foundClass.type === "clsxObjectShorthand") return await processClsx(foundClass, options, uno, filename) ?? {};
|
|
282
274
|
return await processDirective(foundClass, options, uno, filename) ?? {};
|
|
283
275
|
}
|
|
284
|
-
|
|
285
276
|
//#endregion
|
|
286
277
|
//#region src/_preprocess/transformClasses/wrapGlobal.ts
|
|
287
278
|
const EXTRACT_SELECTOR_RE = new RegExp(/(?<![\d(])/.source + /([[.][\s\S]+?)/.source + /(\{[\s\S]+?\})/.source, "g");
|
|
288
279
|
function wrapSelectorsWithGlobal(css) {
|
|
289
280
|
return css.replace(EXTRACT_SELECTOR_RE, ":global($1)$2");
|
|
290
281
|
}
|
|
291
|
-
|
|
292
282
|
//#endregion
|
|
293
283
|
//#region src/_preprocess/transformClasses/index.ts
|
|
294
284
|
async function transformClasses({ content, filename, uno, options }) {
|
|
@@ -329,14 +319,13 @@ async function generateStyles(rulesToGenerate, uno) {
|
|
|
329
319
|
});
|
|
330
320
|
return wrapSelectorsWithGlobal(css);
|
|
331
321
|
}
|
|
332
|
-
|
|
333
322
|
//#endregion
|
|
334
323
|
//#region src/_preprocess/transformApply/getUtils.ts
|
|
335
324
|
async function getUtils(body, uno) {
|
|
336
325
|
return (await parseUtils(expandVariantGroup(body).split(/\s+/g).map((className) => className.trim().replace(/\\/, "")), uno)).sort(([aIndex], [bIndex]) => aIndex - bIndex).sort(([, , , aParent], [, , , bParent]) => (aParent ? uno.parentOrders.get(aParent) ?? 0 : 0) - (bParent ? uno.parentOrders.get(bParent) ?? 0 : 0)).reduce((acc, item) => {
|
|
337
|
-
const [, selector, body
|
|
326
|
+
const [, selector, body, parent] = item;
|
|
338
327
|
const sibling = acc.find(([, targetSelector, , targetParent]) => targetSelector === selector && targetParent === parent);
|
|
339
|
-
if (sibling) sibling[2] += body
|
|
328
|
+
if (sibling) sibling[2] += body;
|
|
340
329
|
else acc.push([...item]);
|
|
341
330
|
return acc;
|
|
342
331
|
}, []);
|
|
@@ -350,14 +339,12 @@ async function parseUtils(classNames, uno) {
|
|
|
350
339
|
}
|
|
351
340
|
return foundUtils.flat();
|
|
352
341
|
}
|
|
353
|
-
|
|
354
342
|
//#endregion
|
|
355
343
|
//#region src/_preprocess/transformApply/removeOuterQuotes.ts
|
|
356
344
|
function removeOuterQuotes(input) {
|
|
357
345
|
if (!input) return "";
|
|
358
346
|
return /^(['"]).*\1$/.test(input) ? input.slice(1, -1) : input;
|
|
359
347
|
}
|
|
360
|
-
|
|
361
348
|
//#endregion
|
|
362
349
|
//#region src/_preprocess/transformApply/writeUtilStyles.ts
|
|
363
350
|
function writeUtilStyles([, selector, body, parent], s, node, childNode) {
|
|
@@ -366,8 +353,8 @@ function writeUtilStyles([, selector, body, parent], s, node, childNode) {
|
|
|
366
353
|
if (!parent && !selectorChanged) return s.appendRight(childNode.loc.end.offset, body);
|
|
367
354
|
const originalSelector = generate(node.prelude);
|
|
368
355
|
if (parent && !selectorChanged) {
|
|
369
|
-
const css
|
|
370
|
-
return s.appendLeft(node.loc.end.offset, css
|
|
356
|
+
const css = `${parent}{${originalSelector}{${body}}}`;
|
|
357
|
+
return s.appendLeft(node.loc.end.offset, css);
|
|
371
358
|
}
|
|
372
359
|
const rule = `${surroundAllButOriginalSelectorWithGlobal(originalSelector, generateUpdatedSelector(selector.replace(regexScopePlaceholder, " "), node.prelude))}{${body}}`;
|
|
373
360
|
const css = parent ? `${parent}{${rule}}` : rule;
|
|
@@ -410,7 +397,6 @@ function findFirstCombinatorIndex(input) {
|
|
|
410
397
|
}
|
|
411
398
|
return -1;
|
|
412
399
|
}
|
|
413
|
-
|
|
414
400
|
//#endregion
|
|
415
401
|
//#region src/_preprocess/transformApply/index.ts
|
|
416
402
|
async function transformApply(ctx) {
|
|
@@ -447,7 +433,6 @@ function getChildNodeValue(childNode, applyVariables) {
|
|
|
447
433
|
if (childNode.type === "Atrule" && childNode.name === "apply" && childNode.prelude && childNode.prelude.type === "Raw") return childNode.prelude.value.trim();
|
|
448
434
|
if (childNode.type === "Declaration" && applyVariables.includes(childNode.property) && childNode.value.type === "Raw") return removeOuterQuotes(childNode.value.value.trim());
|
|
449
435
|
}
|
|
450
|
-
|
|
451
436
|
//#endregion
|
|
452
437
|
//#region src/_preprocess/transformTheme.ts
|
|
453
438
|
const themeRE = /theme\((.+?)\)/g;
|
|
@@ -463,7 +448,6 @@ function getThemeValue(rawArguments, theme) {
|
|
|
463
448
|
else current = current[key];
|
|
464
449
|
return current;
|
|
465
450
|
}
|
|
466
|
-
|
|
467
451
|
//#endregion
|
|
468
452
|
//#region src/_preprocess/transformStyle.ts
|
|
469
453
|
const DEFAULT_APPLY_VARIABLES = ["--at-apply"];
|
|
@@ -496,7 +480,6 @@ async function transformStyle({ content, uno, prepend, filename, applyVariables,
|
|
|
496
480
|
})
|
|
497
481
|
};
|
|
498
482
|
}
|
|
499
|
-
|
|
500
483
|
//#endregion
|
|
501
484
|
//#region src/_preprocess/index.ts
|
|
502
485
|
function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
|
|
@@ -558,6 +541,5 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
|
|
|
558
541
|
}
|
|
559
542
|
};
|
|
560
543
|
}
|
|
561
|
-
|
|
562
544
|
//#endregion
|
|
563
|
-
export { UnocssSveltePreprocess as t };
|
|
545
|
+
export { UnocssSveltePreprocess as t };
|
package/dist/preprocess.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TransformDirectivesOptions, i as TransformClassesOptions, n as SvelteScopedContext, o as UnocssSveltePreprocessOptions, r as TransformApplyOptions, t as UnocssSveltePreprocess } from "./preprocess-
|
|
1
|
+
import { a as TransformDirectivesOptions, i as TransformClassesOptions, n as SvelteScopedContext, o as UnocssSveltePreprocessOptions, r as TransformApplyOptions, t as UnocssSveltePreprocess } from "./preprocess-BolxGJ9J.mjs";
|
|
2
2
|
export { SvelteScopedContext, TransformApplyOptions, TransformClassesOptions, TransformDirectivesOptions, UnocssSveltePreprocessOptions, UnocssSveltePreprocess as default };
|
package/dist/preprocess.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { t as UnocssSveltePreprocess } from "./preprocess-
|
|
2
|
-
|
|
3
|
-
export { UnocssSveltePreprocess as default };
|
|
1
|
+
import { t as UnocssSveltePreprocess } from "./preprocess-CZVi4cj2.mjs";
|
|
2
|
+
export { UnocssSveltePreprocess as default };
|
package/dist/vite.d.mts
CHANGED
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as UnocssSveltePreprocess } from "./preprocess-
|
|
1
|
+
import { t as UnocssSveltePreprocess } from "./preprocess-CZVi4cj2.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { createRecoveryConfigLoader } from "@unocss/config";
|
|
4
4
|
import { createGenerator, cssIdRE } from "@unocss/core";
|
|
@@ -8,7 +8,6 @@ import remapping from "@jridgewell/remapping";
|
|
|
8
8
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
9
9
|
import { dirname, resolve } from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
|
|
12
11
|
//#region src/_vite/config-hmr.ts
|
|
13
12
|
function ConfigHMRPlugin({ ready }) {
|
|
14
13
|
return {
|
|
@@ -26,14 +25,9 @@ function ConfigHMRPlugin({ ready }) {
|
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../../virtual-shared/integration/src/constants.ts
|
|
32
|
-
const IGNORE_COMMENT = "@unocss-ignore";
|
|
33
28
|
const SKIP_START_COMMENT = "@unocss-skip-start";
|
|
34
29
|
const SKIP_END_COMMENT = "@unocss-skip-end";
|
|
35
30
|
const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
|
|
36
|
-
|
|
37
31
|
//#endregion
|
|
38
32
|
//#region ../../virtual-shared/integration/src/utils.ts
|
|
39
33
|
function hash(str) {
|
|
@@ -59,11 +53,10 @@ function restoreSkipCode(code, map) {
|
|
|
59
53
|
for (const [withHashKey, matched] of map.entries()) code = code.replaceAll(withHashKey, matched);
|
|
60
54
|
return code;
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
//#endregion
|
|
64
57
|
//#region ../../virtual-shared/integration/src/transformers.ts
|
|
65
58
|
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
66
|
-
if (original.includes(
|
|
59
|
+
if (original.includes("@unocss-ignore")) return;
|
|
67
60
|
const transformers = (ctx.uno.config.transformers || []).filter((i) => (i.enforce || "default") === enforce);
|
|
68
61
|
if (!transformers.length) return;
|
|
69
62
|
const skipMap = /* @__PURE__ */ new Map();
|
|
@@ -86,13 +79,12 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
|
86
79
|
}
|
|
87
80
|
if (code !== original) return {
|
|
88
81
|
code,
|
|
89
|
-
map: remapping(maps, (_, ctx
|
|
90
|
-
ctx
|
|
82
|
+
map: remapping(maps, (_, ctx) => {
|
|
83
|
+
ctx.content = code;
|
|
91
84
|
return null;
|
|
92
85
|
})
|
|
93
86
|
};
|
|
94
87
|
}
|
|
95
|
-
|
|
96
88
|
//#endregion
|
|
97
89
|
//#region src/_vite/createCssTransformerPlugins.ts
|
|
98
90
|
const svelteIdRE = /[&?]svelte/;
|
|
@@ -114,13 +106,11 @@ function createCssTransformerPlugins(context, cssTransformers) {
|
|
|
114
106
|
}
|
|
115
107
|
}));
|
|
116
108
|
}
|
|
117
|
-
|
|
118
109
|
//#endregion
|
|
119
110
|
//#region src/_vite/constants.ts
|
|
120
111
|
const PLACEHOLDER_USER_SETS_IN_INDEX_HTML = "%unocss-svelte-scoped.global%";
|
|
121
112
|
const DEV_GLOBAL_STYLES_DATA_TITLE = "unocss-svelte-scoped global styles";
|
|
122
113
|
const GLOBAL_STYLES_CSS_FILE_NAME = "unocss-svelte-scoped-global.css";
|
|
123
|
-
|
|
124
114
|
//#endregion
|
|
125
115
|
//#region src/_vite/getReset.ts
|
|
126
116
|
const _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
|
@@ -147,7 +137,6 @@ function getReset(injectReset) {
|
|
|
147
137
|
function isFile(path) {
|
|
148
138
|
return existsSync(path) && statSync(path).isFile();
|
|
149
139
|
}
|
|
150
|
-
|
|
151
140
|
//#endregion
|
|
152
141
|
//#region src/_vite/global.ts
|
|
153
142
|
async function generateGlobalCss(uno, injectReset) {
|
|
@@ -163,13 +152,12 @@ function checkTransformPageChunkHook(server, isSvelteKit) {
|
|
|
163
152
|
const originalWrite = res.write;
|
|
164
153
|
res.write = function(chunk, ...rest) {
|
|
165
154
|
const str = typeof chunk === "string" ? chunk : chunk instanceof Buffer ? chunk.toString() : Array.isArray(chunk) || "at" in chunk ? Buffer.from(chunk).toString() : `${chunk}`;
|
|
166
|
-
if (str.includes("<head>") && !str.includes(
|
|
155
|
+
if (str.includes("<head>") && !str.includes("unocss-svelte-scoped global styles")) server.config.logger.error(`[unocss] You have not setup the svelte-scoped global styles correctly. You must place '${PLACEHOLDER_USER_SETS_IN_INDEX_HTML}' in your \`${isSvelteKit ? "app.html" : "index.html"}\` file.`, { timestamp: true });
|
|
167
156
|
return originalWrite.call(this, chunk, ...rest);
|
|
168
157
|
};
|
|
169
158
|
next();
|
|
170
159
|
});
|
|
171
160
|
}
|
|
172
|
-
|
|
173
161
|
//#endregion
|
|
174
162
|
//#region src/_vite/globalStylesPlugin.ts
|
|
175
163
|
function GlobalStylesPlugin(ctx, injectReset) {
|
|
@@ -195,29 +183,27 @@ function GlobalStylesPlugin(ctx, injectReset) {
|
|
|
195
183
|
await ctx.ready;
|
|
196
184
|
if (isSvelteKit) {
|
|
197
185
|
if (id.includes("hooks") && id.includes("server") && code.includes("unocss_svelte_scoped_global_styles")) this.warn(`[unocss] You are probably using an outdated setup for your sveltekit app. The server hook to handle an unocss styles placeholder is no longer needed.`);
|
|
198
|
-
if (viteConfig.command === "serve" && code.includes(
|
|
186
|
+
if (viteConfig.command === "serve" && code.includes("%unocss-svelte-scoped.global%")) {
|
|
199
187
|
const tag = `<link href=\\"${viteConfig.base ?? "/"}${GLOBAL_STYLES_CSS_FILE_NAME}\\" rel=\\"stylesheet\\" data-title=\\"${DEV_GLOBAL_STYLES_DATA_TITLE}\\" />`;
|
|
200
188
|
return { code: code.replace(PLACEHOLDER_USER_SETS_IN_INDEX_HTML, tag) };
|
|
201
189
|
}
|
|
202
190
|
}
|
|
203
191
|
},
|
|
204
|
-
async buildStart() {
|
|
205
|
-
if (viteConfig.command === "build") unoCssFileReferenceId = this.emitFile({
|
|
206
|
-
type: "asset",
|
|
207
|
-
name: GLOBAL_STYLES_CSS_FILE_NAME
|
|
208
|
-
});
|
|
209
|
-
},
|
|
210
192
|
async buildEnd() {
|
|
211
193
|
if (viteConfig.command === "build") {
|
|
212
194
|
const css = await generateGlobalCss(ctx.uno, injectReset);
|
|
213
|
-
this.
|
|
195
|
+
unoCssFileReferenceId = this.emitFile({
|
|
196
|
+
type: "asset",
|
|
197
|
+
name: GLOBAL_STYLES_CSS_FILE_NAME,
|
|
198
|
+
source: css
|
|
199
|
+
});
|
|
214
200
|
}
|
|
215
201
|
},
|
|
216
202
|
renderStart() {
|
|
217
203
|
unoCssGlobalFileName = this.getFileName(unoCssFileReferenceId);
|
|
218
204
|
},
|
|
219
205
|
renderChunk(code) {
|
|
220
|
-
if (isSvelteKit && code.includes(
|
|
206
|
+
if (isSvelteKit && code.includes("%unocss-svelte-scoped.global%")) {
|
|
221
207
|
const tag = `<link href=\\"${viteConfig.base ?? "/"}${unoCssGlobalFileName}\\" rel=\\"stylesheet\\" />`;
|
|
222
208
|
return code.replace(PLACEHOLDER_USER_SETS_IN_INDEX_HTML, tag);
|
|
223
209
|
}
|
|
@@ -230,7 +216,6 @@ function GlobalStylesPlugin(ctx, injectReset) {
|
|
|
230
216
|
}
|
|
231
217
|
};
|
|
232
218
|
}
|
|
233
|
-
|
|
234
219
|
//#endregion
|
|
235
220
|
//#region src/_vite/passPreprocessToSveltePlugin.ts
|
|
236
221
|
function PassPreprocessToSveltePlugin(context, options = {}) {
|
|
@@ -245,7 +230,6 @@ function PassPreprocessToSveltePlugin(context, options = {}) {
|
|
|
245
230
|
api: { sveltePreprocess: UnocssSveltePreprocess(options, context, isBuild) }
|
|
246
231
|
};
|
|
247
232
|
}
|
|
248
|
-
|
|
249
233
|
//#endregion
|
|
250
234
|
//#region src/_vite/index.ts
|
|
251
235
|
function UnocssSvelteScopedVite(options = {}) {
|
|
@@ -283,6 +267,5 @@ function createSvelteScopedContext(configOrPath) {
|
|
|
283
267
|
ready
|
|
284
268
|
};
|
|
285
269
|
}
|
|
286
|
-
|
|
287
270
|
//#endregion
|
|
288
|
-
export { UnocssSvelteScopedVite as default };
|
|
271
|
+
export { UnocssSvelteScopedVite as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/svelte-scoped",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.6.
|
|
4
|
+
"version": "66.6.8",
|
|
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",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"acorn": "^8.16.0",
|
|
47
|
-
"css-tree": "^3.1
|
|
47
|
+
"css-tree": "^3.2.1",
|
|
48
48
|
"magic-string": "^0.30.21",
|
|
49
49
|
"zimmerframe": "^1.1.4",
|
|
50
|
-
"@unocss/config": "66.6.
|
|
51
|
-
"@unocss/core": "66.6.
|
|
52
|
-
"@unocss/preset-uno": "66.6.
|
|
53
|
-
"@unocss/
|
|
54
|
-
"@unocss/
|
|
50
|
+
"@unocss/config": "66.6.8",
|
|
51
|
+
"@unocss/core": "66.6.8",
|
|
52
|
+
"@unocss/preset-uno": "66.6.8",
|
|
53
|
+
"@unocss/preset-wind3": "66.6.8",
|
|
54
|
+
"@unocss/reset": "66.6.8"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"prettier-plugin-svelte": "^2.10.1",
|
|
58
|
-
"svelte": "^5.
|
|
59
|
-
"vite": "^
|
|
58
|
+
"svelte": "^5.55.2",
|
|
59
|
+
"vite": "^8.0.7"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsdown --config-loader unrun",
|