@unocss/nuxt 0.8.0 → 0.9.2
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/README.md +9 -0
- package/dist/index.d.ts +43 -1
- package/dist/index.mjs +41 -13
- package/index.cjs +6 -0
- package/package.json +14 -7
- package/runtime/UnoIcon.vue +3 -0
- package/dist/index.js +0 -52
package/README.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Nuxt module for UnoCSS
|
|
4
4
|
|
|
5
|
+
## Supporting Status
|
|
6
|
+
|
|
7
|
+
| | Nuxt 2 | Nuxt Bridge | Nuxt 3 |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| Webpack Dev | ✅ | ✅ | 🚧 |
|
|
10
|
+
| Webpack Build | ✅ | ✅ | ✅ |
|
|
11
|
+
| Vite Dev | - | ✅ | ✅ |
|
|
12
|
+
| Vite Build | - | ✅ | ✅ |
|
|
13
|
+
|
|
5
14
|
## Installation
|
|
6
15
|
|
|
7
16
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
import * as _nuxt_kit from '@nuxt/kit';
|
|
2
|
+
import { UserConfig } from '@unocss/core';
|
|
3
|
+
import { AttributifyOptions } from '@unocss/preset-attributify';
|
|
4
|
+
import { IconsOptions } from '@unocss/preset-icons';
|
|
2
5
|
|
|
6
|
+
interface UnocssNuxtOptions extends UserConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Injecting `uno.css` entry automatically
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
autoImport?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Installing UnoCSS components
|
|
15
|
+
* - `<UnoIcon>`
|
|
16
|
+
*
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
components?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Enable the default preset
|
|
22
|
+
* Only works when `presets` is not specified
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
uno?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Enable attributify mode and the options of it
|
|
28
|
+
* Only works when `presets` is not specified
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
attributify?: boolean | AttributifyOptions;
|
|
32
|
+
/**
|
|
33
|
+
* Enable icons preset and the options of it
|
|
34
|
+
* Only works when `presets` is not specified
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
icons?: boolean | IconsOptions;
|
|
38
|
+
}
|
|
3
39
|
declare const _default: _nuxt_kit.LegacyNuxtModule;
|
|
4
40
|
|
|
5
|
-
|
|
41
|
+
declare module '@nuxt/kit' {
|
|
42
|
+
interface NuxtOptions {
|
|
43
|
+
unocss?: UnocssNuxtOptions;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { UnocssNuxtOptions, _default as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,51 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { dirname, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { defineNuxtModule, extendViteConfig, extendWebpackConfig, addPluginTemplate, addComponentsDir } from "@nuxt/kit";
|
|
5
|
+
import presetUno from "@unocss/preset-uno";
|
|
6
|
+
import presetAttributify from "@unocss/preset-attributify";
|
|
7
|
+
import presetIcons from "@unocss/preset-icons";
|
|
8
|
+
import WebpackPlugin from "@unocss/webpack";
|
|
9
|
+
import VitePlugin from "@unocss/vite";
|
|
10
|
+
var dir = dirname(fileURLToPath(import.meta.url));
|
|
4
11
|
var src_default = defineNuxtModule({
|
|
5
12
|
name: "unocss",
|
|
6
|
-
defaults: {
|
|
13
|
+
defaults: {
|
|
14
|
+
autoImport: true,
|
|
15
|
+
components: true,
|
|
16
|
+
uno: true
|
|
17
|
+
},
|
|
7
18
|
configKey: "unocss",
|
|
8
|
-
setup(options
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
setup(options) {
|
|
20
|
+
if (options.presets == null) {
|
|
21
|
+
options.presets = [];
|
|
22
|
+
if (options.uno)
|
|
23
|
+
options.presets.push(presetUno());
|
|
24
|
+
if (options.attributify)
|
|
25
|
+
options.presets.push(presetAttributify(typeof options.attributify == "boolean" ? {} : options.attributify));
|
|
26
|
+
if (options.icons)
|
|
27
|
+
options.presets.push(presetIcons(typeof options.icons == "boolean" ? {} : options.icons));
|
|
28
|
+
}
|
|
29
|
+
if (options.autoImport) {
|
|
30
|
+
addPluginTemplate({
|
|
31
|
+
filename: "unocss.mjs",
|
|
32
|
+
src: "",
|
|
33
|
+
getContents: () => "import 'uno.css';export default () => {};"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (options.components) {
|
|
37
|
+
addComponentsDir({
|
|
38
|
+
path: resolve(dir, "../runtime"),
|
|
39
|
+
watch: false
|
|
40
|
+
});
|
|
41
|
+
}
|
|
15
42
|
extendViteConfig((config) => {
|
|
16
43
|
config.plugins = config.plugins || [];
|
|
17
|
-
config.plugins.unshift(...
|
|
44
|
+
config.plugins.unshift(...VitePlugin(options));
|
|
18
45
|
});
|
|
19
|
-
extendWebpackConfig(() => {
|
|
20
|
-
|
|
46
|
+
extendWebpackConfig((config) => {
|
|
47
|
+
config.plugins = config.plugins || [];
|
|
48
|
+
config.plugins.unshift(WebpackPlugin(options));
|
|
21
49
|
});
|
|
22
50
|
}
|
|
23
51
|
});
|
package/index.cjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Nuxt module for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -23,18 +23,25 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"require": "./
|
|
26
|
+
"require": "./index.cjs",
|
|
27
27
|
"import": "./dist/index.mjs"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
"main": "
|
|
31
|
-
"module": "dist/index.mjs",
|
|
32
|
-
"types": "dist/index.d.ts",
|
|
30
|
+
"main": "./index.cjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
33
|
"files": [
|
|
34
|
-
"dist"
|
|
34
|
+
"dist",
|
|
35
|
+
"index.cjs",
|
|
36
|
+
"runtime"
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
|
-
"unocss": "0.
|
|
39
|
+
"@unocss/core": "0.9.2",
|
|
40
|
+
"@unocss/webpack": "0.9.2",
|
|
41
|
+
"@unocss/vite": "0.9.2",
|
|
42
|
+
"@unocss/preset-uno": "0.9.2",
|
|
43
|
+
"@unocss/preset-attributify": "0.9.2",
|
|
44
|
+
"@unocss/preset-icons": "0.9.2",
|
|
38
45
|
"@nuxt/kit": "npm:@nuxt/kit-edge@latest"
|
|
39
46
|
},
|
|
40
47
|
"scripts": {
|
package/dist/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
__markAsModule(target);
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, module2, desc) => {
|
|
14
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(module2))
|
|
16
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
var __toModule = (module2) => {
|
|
22
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// src/index.ts
|
|
26
|
-
__export(exports, {
|
|
27
|
-
default: () => src_default
|
|
28
|
-
});
|
|
29
|
-
var import_kit = __toModule(require("@nuxt/kit"));
|
|
30
|
-
var import_vite = __toModule(require("unocss/vite"));
|
|
31
|
-
var src_default = (0, import_kit.defineNuxtModule)({
|
|
32
|
-
name: "unocss",
|
|
33
|
-
defaults: {},
|
|
34
|
-
configKey: "unocss",
|
|
35
|
-
setup(options, nuxt) {
|
|
36
|
-
nuxt.options.alias["/_nuxt/@unocss-entry.css"] = "/@unocss-entry.css";
|
|
37
|
-
(0, import_kit.addPluginTemplate)({
|
|
38
|
-
filename: "unocss.mjs",
|
|
39
|
-
src: "",
|
|
40
|
-
getContents: () => "import 'uno.css';export default () => {};"
|
|
41
|
-
});
|
|
42
|
-
(0, import_kit.extendViteConfig)((config) => {
|
|
43
|
-
config.plugins = config.plugins || [];
|
|
44
|
-
config.plugins.unshift(...(0, import_vite.default)(options));
|
|
45
|
-
});
|
|
46
|
-
(0, import_kit.extendWebpackConfig)(() => {
|
|
47
|
-
throw new Error("UnoCSS does not support Webpack at this moment");
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {});
|