@unocss/svelte-scoped 0.61.2 → 0.61.4
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.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { expandVariantGroup, regexScopePlaceholder, warnOnce, toArray, createGenerator } from '@unocss/core';
|
|
3
3
|
import presetUno from '@unocss/preset-uno';
|
|
4
|
-
import {
|
|
4
|
+
import { createRecoveryConfigLoader } from '@unocss/config';
|
|
5
5
|
import MagicString from 'magic-string';
|
|
6
6
|
import { generate, parse, clone, walk } from 'css-tree';
|
|
7
7
|
|
|
@@ -419,10 +419,11 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
|
|
|
419
419
|
if (!options.classPrefix)
|
|
420
420
|
options.classPrefix = "usp-";
|
|
421
421
|
let uno;
|
|
422
|
+
const loadConfig = createRecoveryConfigLoader();
|
|
422
423
|
return {
|
|
423
424
|
markup: async ({ content, filename }) => {
|
|
424
425
|
if (!uno)
|
|
425
|
-
uno = await getGenerator(options.configOrPath, unoContextFromVite);
|
|
426
|
+
uno = await getGenerator((await loadConfig(process.cwd(), options.configOrPath)).config, unoContextFromVite);
|
|
426
427
|
if (isViteBuild && options.combine === void 0)
|
|
427
428
|
options.combine = isViteBuild();
|
|
428
429
|
return await transformClasses({ content, filename: filename || "", uno, options });
|
|
@@ -445,7 +446,7 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
|
|
|
445
446
|
if (!changeNeeded)
|
|
446
447
|
return;
|
|
447
448
|
if (!uno)
|
|
448
|
-
uno = await getGenerator(
|
|
449
|
+
uno = await getGenerator((await loadConfig()).config);
|
|
449
450
|
let preflightsSafelistCss = "";
|
|
450
451
|
if (addPreflights || addSafelist) {
|
|
451
452
|
const { css } = await uno.generate([], { preflights: !!addPreflights, safelist: !!addSafelist, minify: true });
|
|
@@ -466,7 +467,7 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
|
|
|
466
467
|
}
|
|
467
468
|
};
|
|
468
469
|
}
|
|
469
|
-
async function getGenerator(
|
|
470
|
+
async function getGenerator(config, unoContextFromVite) {
|
|
470
471
|
if (unoContextFromVite) {
|
|
471
472
|
await unoContextFromVite.ready;
|
|
472
473
|
return unoContextFromVite.uno;
|
|
@@ -476,7 +477,6 @@ async function getGenerator(configOrPath, unoContextFromVite) {
|
|
|
476
477
|
presetUno()
|
|
477
478
|
]
|
|
478
479
|
};
|
|
479
|
-
const { config } = await loadConfig(process.cwd(), configOrPath);
|
|
480
480
|
return createGenerator(config, defaults);
|
|
481
481
|
}
|
|
482
482
|
|
package/dist/vite.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { cssIdRE, createGenerator } from '@unocss/core';
|
|
3
|
-
import {
|
|
3
|
+
import { createRecoveryConfigLoader } from '@unocss/config';
|
|
4
4
|
import presetUno from '@unocss/preset-uno';
|
|
5
|
-
import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.
|
|
5
|
+
import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.BBcG3K4A.mjs';
|
|
6
6
|
import { readFileSync, existsSync, statSync } from 'node:fs';
|
|
7
7
|
import { dirname, resolve } from 'node:path';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
@@ -278,6 +278,7 @@ const defaults = {
|
|
|
278
278
|
function createSvelteScopedContext(configOrPath) {
|
|
279
279
|
const uno = createGenerator();
|
|
280
280
|
const ready = reloadConfig();
|
|
281
|
+
const loadConfig = createRecoveryConfigLoader();
|
|
281
282
|
async function reloadConfig() {
|
|
282
283
|
const { config, sources } = await loadConfig(process.cwd(), configOrPath);
|
|
283
284
|
uno.setConfig(config, defaults);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/svelte-scoped",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.61.
|
|
4
|
+
"version": "0.61.4",
|
|
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,8 +52,8 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"css-tree": "^2.3.1",
|
|
54
54
|
"magic-string": "^0.30.10",
|
|
55
|
-
"@unocss/config": "0.61.
|
|
56
|
-
"@unocss/reset": "0.61.
|
|
55
|
+
"@unocss/config": "0.61.4",
|
|
56
|
+
"@unocss/reset": "0.61.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"prettier-plugin-svelte": "^2.10.1",
|