@unocss/nuxt 0.58.2 → 0.58.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/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +11 -29
- package/package.json +16 -16
package/dist/index.d.mts
CHANGED
|
@@ -28,10 +28,17 @@ interface UnocssNuxtOptions extends UserConfig {
|
|
|
28
28
|
* @default false
|
|
29
29
|
*/
|
|
30
30
|
preflight?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Set Nuxt's `features.inlineStyle` to `false` by default to make it work with UnoCSS.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
disableNuxtInlineStyle?: boolean;
|
|
31
37
|
/**
|
|
32
38
|
* Adjust the position of the `uno.css` injection. (Depends on `mode`)
|
|
33
39
|
*
|
|
34
40
|
* @default 'first'
|
|
41
|
+
* @deprecated Temporarily removed, will be added back in the future.
|
|
35
42
|
*/
|
|
36
43
|
injectPosition?: 'first' | 'last' | number | {
|
|
37
44
|
after?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,10 +28,17 @@ interface UnocssNuxtOptions extends UserConfig {
|
|
|
28
28
|
* @default false
|
|
29
29
|
*/
|
|
30
30
|
preflight?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Set Nuxt's `features.inlineStyle` to `false` by default to make it work with UnoCSS.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
disableNuxtInlineStyle?: boolean;
|
|
31
37
|
/**
|
|
32
38
|
* Adjust the position of the `uno.css` injection. (Depends on `mode`)
|
|
33
39
|
*
|
|
34
40
|
* @default 'first'
|
|
41
|
+
* @deprecated Temporarily removed, will be added back in the future.
|
|
35
42
|
*/
|
|
36
43
|
injectPosition?: 'first' | 'last' | number | {
|
|
37
44
|
after?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -43,27 +43,6 @@ function resolveOptions(options) {
|
|
|
43
43
|
options.content.pipeline.exclude.push(/\?macro=true/);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function resolveInjectPosition(css, position) {
|
|
47
|
-
if (typeof position === "number")
|
|
48
|
-
return ~~Math.min(position, css.length + 1);
|
|
49
|
-
if (typeof position === "string") {
|
|
50
|
-
switch (position) {
|
|
51
|
-
case "first":
|
|
52
|
-
return 0;
|
|
53
|
-
case "last":
|
|
54
|
-
return css.length;
|
|
55
|
-
default:
|
|
56
|
-
throw new Error(`invalid literal: ${position}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (position?.after !== void 0) {
|
|
60
|
-
const index = css.indexOf(position.after);
|
|
61
|
-
if (index === -1)
|
|
62
|
-
throw new Error(`\`after\` position specifies a file which does not exists on CSS stack: ${position.after}`);
|
|
63
|
-
return index + 1;
|
|
64
|
-
}
|
|
65
|
-
throw new Error(`invalid position: ${JSON.stringify(position)}`);
|
|
66
|
-
}
|
|
67
46
|
|
|
68
47
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
69
48
|
const index = defineNuxtModule({
|
|
@@ -76,7 +55,7 @@ const index = defineNuxtModule({
|
|
|
76
55
|
autoImport: true,
|
|
77
56
|
preflight: false,
|
|
78
57
|
components: true,
|
|
79
|
-
|
|
58
|
+
disableNuxtInlineStyle: true,
|
|
80
59
|
// presets
|
|
81
60
|
uno: true,
|
|
82
61
|
attributify: false,
|
|
@@ -85,19 +64,22 @@ const index = defineNuxtModule({
|
|
|
85
64
|
wind: false
|
|
86
65
|
},
|
|
87
66
|
async setup(options, nuxt) {
|
|
67
|
+
var _a;
|
|
88
68
|
resolveOptions(options);
|
|
69
|
+
options.mode ?? (options.mode = "global");
|
|
70
|
+
const InjectModes = ["global", "dist-chunk"];
|
|
71
|
+
if (options.disableNuxtInlineStyle) {
|
|
72
|
+
(_a = nuxt.options).features || (_a.features = {});
|
|
73
|
+
nuxt.options.features.inlineStyles = false;
|
|
74
|
+
}
|
|
75
|
+
if (options.injectPosition != null)
|
|
76
|
+
console.warn("[unocss/nuxt] options `injectPosition` is temporary removed due to the incompatibility with Nuxt 3.9. We are seeking for better solution. It's not effective at this moment.");
|
|
89
77
|
if (options.autoImport) {
|
|
90
|
-
options.mode ?? (options.mode = "global");
|
|
91
|
-
const InjectModes = ["global", "dist-chunk"];
|
|
92
|
-
nuxt.options.css = nuxt.options.css ?? [];
|
|
93
|
-
if (InjectModes.includes(options.mode) && !nuxt.options.css.includes("uno.css")) {
|
|
94
|
-
const position = resolveInjectPosition(nuxt.options.css, options.injectPosition);
|
|
95
|
-
nuxt.options.css.splice(position, 0, "uno.css");
|
|
96
|
-
}
|
|
97
78
|
addPluginTemplate({
|
|
98
79
|
filename: "unocss.mjs",
|
|
99
80
|
getContents: () => {
|
|
100
81
|
const lines = [
|
|
82
|
+
InjectModes.includes(options.mode) ? "import 'uno.css'" : "",
|
|
101
83
|
isNuxt2() ? "export default () => {}" : "import { defineNuxtPlugin } from '#imports'; export default defineNuxtPlugin(() => {})"
|
|
102
84
|
];
|
|
103
85
|
if (options.preflight)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/nuxt",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.4",
|
|
4
4
|
"description": "Nuxt module for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
"runtime"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@nuxt/kit": "^3.9.
|
|
41
|
-
"@unocss/
|
|
42
|
-
"@unocss/
|
|
43
|
-
"@unocss/preset-attributify": "0.58.
|
|
44
|
-
"@unocss/preset-icons": "0.58.
|
|
45
|
-
"@unocss/preset-
|
|
46
|
-
"@unocss/preset-
|
|
47
|
-
"@unocss/preset-uno": "0.58.
|
|
48
|
-
"@unocss/preset-web-fonts": "0.58.
|
|
49
|
-
"@unocss/preset-wind": "0.58.
|
|
50
|
-
"@unocss/reset": "0.58.
|
|
51
|
-
"@unocss/vite": "0.58.
|
|
52
|
-
"@unocss/webpack": "0.58.
|
|
53
|
-
"unocss": "0.58.
|
|
40
|
+
"@nuxt/kit": "^3.9.3",
|
|
41
|
+
"@unocss/config": "0.58.4",
|
|
42
|
+
"@unocss/core": "0.58.4",
|
|
43
|
+
"@unocss/preset-attributify": "0.58.4",
|
|
44
|
+
"@unocss/preset-icons": "0.58.4",
|
|
45
|
+
"@unocss/preset-tagify": "0.58.4",
|
|
46
|
+
"@unocss/preset-typography": "0.58.4",
|
|
47
|
+
"@unocss/preset-uno": "0.58.4",
|
|
48
|
+
"@unocss/preset-web-fonts": "0.58.4",
|
|
49
|
+
"@unocss/preset-wind": "0.58.4",
|
|
50
|
+
"@unocss/reset": "0.58.4",
|
|
51
|
+
"@unocss/vite": "0.58.4",
|
|
52
|
+
"@unocss/webpack": "0.58.4",
|
|
53
|
+
"unocss": "0.58.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@nuxt/schema": "^3.9.
|
|
56
|
+
"@nuxt/schema": "^3.9.3"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "unbuild",
|