@unocss/nuxt 0.14.2 → 0.15.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/dist/index.cjs +73 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +13 -14
- package/package.json +10 -10
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const url = require('url');
|
|
5
|
+
const kit = require('@nuxt/kit');
|
|
6
|
+
const presetUno = require('@unocss/preset-uno');
|
|
7
|
+
const presetAttributify = require('@unocss/preset-attributify');
|
|
8
|
+
const presetIcons = require('@unocss/preset-icons');
|
|
9
|
+
const WebpackPlugin = require('@unocss/webpack');
|
|
10
|
+
const VitePlugin = require('@unocss/vite');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
13
|
+
|
|
14
|
+
const presetAttributify__default = /*#__PURE__*/_interopDefaultLegacy(presetAttributify);
|
|
15
|
+
const presetIcons__default = /*#__PURE__*/_interopDefaultLegacy(presetIcons);
|
|
16
|
+
const WebpackPlugin__default = /*#__PURE__*/_interopDefaultLegacy(WebpackPlugin);
|
|
17
|
+
const VitePlugin__default = /*#__PURE__*/_interopDefaultLegacy(VitePlugin);
|
|
18
|
+
|
|
19
|
+
const dir = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
20
|
+
const index = kit.defineNuxtModule({
|
|
21
|
+
name: "unocss",
|
|
22
|
+
defaults: {
|
|
23
|
+
uno: true,
|
|
24
|
+
attributify: false,
|
|
25
|
+
preflight: false,
|
|
26
|
+
icons: false,
|
|
27
|
+
components: true,
|
|
28
|
+
autoImport: true
|
|
29
|
+
},
|
|
30
|
+
configKey: "unocss",
|
|
31
|
+
setup(options) {
|
|
32
|
+
if (options.presets == null) {
|
|
33
|
+
options.presets = [];
|
|
34
|
+
if (options.uno)
|
|
35
|
+
options.presets.push(presetUno.presetUno(typeof options.uno === "boolean" ? {} : options.uno));
|
|
36
|
+
if (options.attributify)
|
|
37
|
+
options.presets.push(presetAttributify__default(typeof options.attributify === "boolean" ? {} : options.attributify));
|
|
38
|
+
if (options.icons)
|
|
39
|
+
options.presets.push(presetIcons__default(typeof options.icons === "boolean" ? {} : options.icons));
|
|
40
|
+
}
|
|
41
|
+
if (options.autoImport) {
|
|
42
|
+
kit.addPluginTemplate({
|
|
43
|
+
filename: "unocss.mjs",
|
|
44
|
+
src: "",
|
|
45
|
+
getContents: () => {
|
|
46
|
+
const lines = [
|
|
47
|
+
"import 'uno.css'",
|
|
48
|
+
"export default () => {};"
|
|
49
|
+
];
|
|
50
|
+
if (options.preflight)
|
|
51
|
+
lines.unshift("import '@unocss/reset/tailwind.css'");
|
|
52
|
+
return lines.join("\n");
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (options.components) {
|
|
57
|
+
kit.addComponentsDir({
|
|
58
|
+
path: path.resolve(dir, "../runtime"),
|
|
59
|
+
watch: false
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
kit.extendViteConfig((config) => {
|
|
63
|
+
config.plugins = config.plugins || [];
|
|
64
|
+
config.plugins.unshift(...VitePlugin__default(options));
|
|
65
|
+
});
|
|
66
|
+
kit.extendWebpackConfig((config) => {
|
|
67
|
+
config.plugins = config.plugins || [];
|
|
68
|
+
config.plugins.unshift(WebpackPlugin__default(options));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
module.exports = index;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { PresetUnoOptions } from '@unocss/preset-uno';
|
|
3
3
|
import { AttributifyOptions } from '@unocss/preset-attributify';
|
|
4
4
|
import { IconsOptions } from '@unocss/preset-icons';
|
|
5
5
|
import { UserConfig } from '@unocss/core';
|
|
@@ -29,7 +29,7 @@ interface UnocssNuxtOptions extends UserConfig {
|
|
|
29
29
|
* Only works when `presets` is not specified
|
|
30
30
|
* @default true
|
|
31
31
|
*/
|
|
32
|
-
uno?: boolean |
|
|
32
|
+
uno?: boolean | PresetUnoOptions;
|
|
33
33
|
/**
|
|
34
34
|
* Enable attributify mode and the options of it
|
|
35
35
|
* Only works when `presets` is not specified
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { dirname, resolve } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { defineNuxtModule, addPluginTemplate, addComponentsDir, extendViteConfig, extendWebpackConfig } from '@nuxt/kit';
|
|
4
|
+
import { presetUno } from '@unocss/preset-uno';
|
|
5
|
+
import presetAttributify from '@unocss/preset-attributify';
|
|
6
|
+
import presetIcons from '@unocss/preset-icons';
|
|
7
|
+
import WebpackPlugin from '@unocss/webpack';
|
|
8
|
+
import VitePlugin from '@unocss/vite';
|
|
9
|
+
|
|
10
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const index = defineNuxtModule({
|
|
12
12
|
name: "unocss",
|
|
13
13
|
defaults: {
|
|
14
14
|
uno: true,
|
|
@@ -60,6 +60,5 @@ var src_default = defineNuxtModule({
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
63
|
+
|
|
64
|
+
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Nuxt module for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@nuxt/kit": "npm:@nuxt/kit-edge@latest",
|
|
40
|
-
"@unocss/core": "0.
|
|
41
|
-
"@unocss/preset-attributify": "0.
|
|
42
|
-
"@unocss/preset-icons": "0.
|
|
43
|
-
"@unocss/preset-uno": "0.
|
|
44
|
-
"@unocss/reset": "0.
|
|
45
|
-
"@unocss/vite": "0.
|
|
46
|
-
"@unocss/webpack": "0.
|
|
40
|
+
"@unocss/core": "0.15.2",
|
|
41
|
+
"@unocss/preset-attributify": "0.15.2",
|
|
42
|
+
"@unocss/preset-icons": "0.15.2",
|
|
43
|
+
"@unocss/preset-uno": "0.15.2",
|
|
44
|
+
"@unocss/reset": "0.15.2",
|
|
45
|
+
"@unocss/vite": "0.15.2",
|
|
46
|
+
"@unocss/webpack": "0.15.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@nuxt/schema": "npm:@nuxt/schema-edge@latest"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"build": "
|
|
53
|
-
"
|
|
52
|
+
"build": "unbuild",
|
|
53
|
+
"stub": "unbuild --stub"
|
|
54
54
|
}
|
|
55
55
|
}
|