@unocss/nuxt 0.58.2 → 0.58.3
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +5 -29
- package/package.json +14 -14
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ interface UnocssNuxtOptions extends UserConfig {
|
|
|
32
32
|
* Adjust the position of the `uno.css` injection. (Depends on `mode`)
|
|
33
33
|
*
|
|
34
34
|
* @default 'first'
|
|
35
|
+
* @deprecated Temporarily removed, will be added back in the future.
|
|
35
36
|
*/
|
|
36
37
|
injectPosition?: 'first' | 'last' | number | {
|
|
37
38
|
after?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface UnocssNuxtOptions extends UserConfig {
|
|
|
32
32
|
* Adjust the position of the `uno.css` injection. (Depends on `mode`)
|
|
33
33
|
*
|
|
34
34
|
* @default 'first'
|
|
35
|
+
* @deprecated Temporarily removed, will be added back in the future.
|
|
35
36
|
*/
|
|
36
37
|
injectPosition?: 'first' | 'last' | number | {
|
|
37
38
|
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,6 @@ const index = defineNuxtModule({
|
|
|
76
55
|
autoImport: true,
|
|
77
56
|
preflight: false,
|
|
78
57
|
components: true,
|
|
79
|
-
injectPosition: "first",
|
|
80
58
|
// presets
|
|
81
59
|
uno: true,
|
|
82
60
|
attributify: false,
|
|
@@ -86,18 +64,16 @@ const index = defineNuxtModule({
|
|
|
86
64
|
},
|
|
87
65
|
async setup(options, nuxt) {
|
|
88
66
|
resolveOptions(options);
|
|
67
|
+
options.mode ?? (options.mode = "global");
|
|
68
|
+
const InjectModes = ["global", "dist-chunk"];
|
|
69
|
+
if (options.injectPosition != null)
|
|
70
|
+
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
71
|
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
72
|
addPluginTemplate({
|
|
98
73
|
filename: "unocss.mjs",
|
|
99
74
|
getContents: () => {
|
|
100
75
|
const lines = [
|
|
76
|
+
InjectModes.includes(options.mode) ? "import 'uno.css'" : "",
|
|
101
77
|
isNuxt2() ? "export default () => {}" : "import { defineNuxtPlugin } from '#imports'; export default defineNuxtPlugin(() => {})"
|
|
102
78
|
];
|
|
103
79
|
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.3",
|
|
4
4
|
"description": "Nuxt module for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@nuxt/kit": "^3.9.0",
|
|
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.
|
|
41
|
+
"@unocss/config": "0.58.3",
|
|
42
|
+
"@unocss/core": "0.58.3",
|
|
43
|
+
"@unocss/preset-attributify": "0.58.3",
|
|
44
|
+
"@unocss/preset-icons": "0.58.3",
|
|
45
|
+
"@unocss/preset-tagify": "0.58.3",
|
|
46
|
+
"@unocss/preset-typography": "0.58.3",
|
|
47
|
+
"@unocss/preset-uno": "0.58.3",
|
|
48
|
+
"@unocss/preset-web-fonts": "0.58.3",
|
|
49
|
+
"@unocss/preset-wind": "0.58.3",
|
|
50
|
+
"@unocss/reset": "0.58.3",
|
|
51
|
+
"@unocss/vite": "0.58.3",
|
|
52
|
+
"@unocss/webpack": "0.58.3",
|
|
53
|
+
"unocss": "0.58.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@nuxt/schema": "^3.9.0"
|