@unocss/svelte-scoped 66.6.7 → 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.
@@ -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
  /**
@@ -136,12 +136,16 @@ async function needsGenerated(token, uno) {
136
136
  //#endregion
137
137
  //#region src/_preprocess/transformClasses/sortClassesIntoCategories.ts
138
138
  async function sortClassesIntoCategories(body, options, uno, filename) {
139
- const { combine = true } = options;
139
+ const { combine = true, hashSafelistClasses = false } = options;
140
140
  const rulesToGenerate = {};
141
141
  const ignore = [];
142
142
  const classes = body.trim().split(/\s+/);
143
143
  const knownClassesToCombine = [];
144
144
  for (const token of classes) {
145
+ if (!hashSafelistClasses && uno.config.safelist.includes(token)) {
146
+ ignore.push(token);
147
+ continue;
148
+ }
145
149
  if (!(isShortcut(token, uno.config.shortcuts) || await needsGenerated(token, uno))) {
146
150
  ignore.push(token);
147
151
  continue;
@@ -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-eGXggMC-.mjs";
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 };
@@ -1,2 +1,2 @@
1
- import { t as UnocssSveltePreprocess } from "./preprocess-C0sgyK1A.mjs";
1
+ import { t as UnocssSveltePreprocess } from "./preprocess-CZVi4cj2.mjs";
2
2
  export { UnocssSveltePreprocess as default };
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as UnocssSveltePreprocessOptions } from "./preprocess-eGXggMC-.mjs";
1
+ import { o as UnocssSveltePreprocessOptions } from "./preprocess-BolxGJ9J.mjs";
2
2
  import { PluginOptions } from "@unocss/core";
3
3
  import { Plugin } from "vite";
4
4
 
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as UnocssSveltePreprocess } from "./preprocess-C0sgyK1A.mjs";
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";
@@ -189,16 +189,14 @@ function GlobalStylesPlugin(ctx, injectReset) {
189
189
  }
190
190
  }
191
191
  },
192
- async buildStart() {
193
- if (viteConfig.command === "build") unoCssFileReferenceId = this.emitFile({
194
- type: "asset",
195
- name: GLOBAL_STYLES_CSS_FILE_NAME
196
- });
197
- },
198
192
  async buildEnd() {
199
193
  if (viteConfig.command === "build") {
200
194
  const css = await generateGlobalCss(ctx.uno, injectReset);
201
- this.setAssetSource(unoCssFileReferenceId, css);
195
+ unoCssFileReferenceId = this.emitFile({
196
+ type: "asset",
197
+ name: GLOBAL_STYLES_CSS_FILE_NAME,
198
+ source: css
199
+ });
202
200
  }
203
201
  },
204
202
  renderStart() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/svelte-scoped",
3
3
  "type": "module",
4
- "version": "66.6.7",
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.0",
47
+ "css-tree": "^3.2.1",
48
48
  "magic-string": "^0.30.21",
49
49
  "zimmerframe": "^1.1.4",
50
- "@unocss/config": "66.6.7",
51
- "@unocss/reset": "66.6.7",
52
- "@unocss/preset-uno": "66.6.7",
53
- "@unocss/preset-wind3": "66.6.7",
54
- "@unocss/core": "66.6.7"
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.53.3",
59
- "vite": "^7.3.1"
58
+ "svelte": "^5.55.2",
59
+ "vite": "^8.0.7"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsdown --config-loader unrun",