@unocss/astro 0.58.8 → 0.59.0-beta.1
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/package.json +9 -9
- package/dist/index.cjs +0 -76
- package/dist/index.d.cts +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/astro",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.59.0-beta.1",
|
|
4
5
|
"description": "UnoCSS integration for Astro",
|
|
5
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
7
|
"license": "MIT",
|
|
@@ -25,12 +26,11 @@
|
|
|
25
26
|
"sideEffects": false,
|
|
26
27
|
"exports": {
|
|
27
28
|
".": {
|
|
28
|
-
"types": "./dist/index.d.
|
|
29
|
-
"
|
|
30
|
-
"require": "./dist/index.cjs"
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
|
+
"default": "./dist/index.mjs"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"main": "./dist/index.
|
|
33
|
+
"main": "./dist/index.mjs",
|
|
34
34
|
"module": "./dist/index.mjs",
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
36
|
"files": [
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@unocss/
|
|
49
|
-
"@unocss/
|
|
50
|
-
"@unocss/vite": "0.
|
|
48
|
+
"@unocss/reset": "0.59.0-beta.1",
|
|
49
|
+
"@unocss/core": "0.59.0-beta.1",
|
|
50
|
+
"@unocss/vite": "0.59.0-beta.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"astro": "^4.5.
|
|
53
|
+
"astro": "^4.5.12"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "unbuild",
|
package/dist/index.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const node_path = require('node:path');
|
|
4
|
-
const node_url = require('node:url');
|
|
5
|
-
const VitePlugin = require('@unocss/vite');
|
|
6
|
-
const vite = require('vite');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
9
|
-
|
|
10
|
-
const VitePlugin__default = /*#__PURE__*/_interopDefaultCompat(VitePlugin);
|
|
11
|
-
|
|
12
|
-
const RESOLVED_ID_RE = /[\/\\]__uno(?:_(.*?))?\.css$/;
|
|
13
|
-
|
|
14
|
-
const UNO_INJECT_ID = "uno-astro";
|
|
15
|
-
function AstroVitePlugin(options) {
|
|
16
|
-
const { injects } = options;
|
|
17
|
-
let root;
|
|
18
|
-
return {
|
|
19
|
-
name: "unocss:astro",
|
|
20
|
-
enforce: "pre",
|
|
21
|
-
configResolved(config) {
|
|
22
|
-
root = config.root;
|
|
23
|
-
},
|
|
24
|
-
async resolveId(id, importer) {
|
|
25
|
-
if (RESOLVED_ID_RE.test(id)) {
|
|
26
|
-
return this.resolve(vite.normalizePath(node_path.join(root, id)), importer, { skipSelf: true });
|
|
27
|
-
}
|
|
28
|
-
if (id === UNO_INJECT_ID)
|
|
29
|
-
return id;
|
|
30
|
-
},
|
|
31
|
-
load(id) {
|
|
32
|
-
if (id.endsWith(UNO_INJECT_ID))
|
|
33
|
-
return injects.join("\n");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function UnoCSSAstroIntegration(options = {}, defaults) {
|
|
38
|
-
const {
|
|
39
|
-
injectEntry = true,
|
|
40
|
-
injectReset = false,
|
|
41
|
-
injectExtra = []
|
|
42
|
-
} = options;
|
|
43
|
-
return {
|
|
44
|
-
name: "unocss",
|
|
45
|
-
hooks: {
|
|
46
|
-
"astro:config:setup": async ({ config, updateConfig, injectScript }) => {
|
|
47
|
-
var _a;
|
|
48
|
-
const source = node_path.resolve(node_url.fileURLToPath(config.srcDir), "components/**/*").replace(/\\/g, "/");
|
|
49
|
-
options.content || (options.content = {});
|
|
50
|
-
(_a = options.content).filesystem || (_a.filesystem = []);
|
|
51
|
-
options.content.filesystem.push(source);
|
|
52
|
-
const injects = [];
|
|
53
|
-
if (injectReset) {
|
|
54
|
-
const resetPath = typeof injectReset === "string" ? injectReset : "@unocss/reset/tailwind.css";
|
|
55
|
-
injects.push(`import ${JSON.stringify(resetPath)}`);
|
|
56
|
-
}
|
|
57
|
-
if (injectEntry) {
|
|
58
|
-
injects.push(typeof injectEntry === "string" ? injectEntry : 'import "uno.css"');
|
|
59
|
-
}
|
|
60
|
-
if (injectExtra.length > 0)
|
|
61
|
-
injects.push(...injectExtra);
|
|
62
|
-
updateConfig({
|
|
63
|
-
vite: {
|
|
64
|
-
plugins: [AstroVitePlugin({
|
|
65
|
-
injects
|
|
66
|
-
}), ...VitePlugin__default(options, defaults)]
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
if (injects?.length)
|
|
70
|
-
injectScript("page-ssr", `import ${JSON.stringify(UNO_INJECT_ID)}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
module.exports = UnoCSSAstroIntegration;
|
package/dist/index.d.cts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AstroIntegration } from 'astro';
|
|
2
|
-
import { VitePluginConfig } from '@unocss/vite';
|
|
3
|
-
import { UserConfigDefaults } from '@unocss/core';
|
|
4
|
-
|
|
5
|
-
interface AstroIntegrationConfig<Theme extends object = object> extends VitePluginConfig<Theme> {
|
|
6
|
-
/**
|
|
7
|
-
* Include reset styles
|
|
8
|
-
* When passing `true`, `@unocss/reset/tailwind.css` will be used
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
injectReset?: string | boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Inject UnoCSS entry import for every astro page
|
|
14
|
-
* @default true
|
|
15
|
-
*/
|
|
16
|
-
injectEntry?: boolean | string;
|
|
17
|
-
/**
|
|
18
|
-
* Inject extra imports for every astro page
|
|
19
|
-
* @default []
|
|
20
|
-
*/
|
|
21
|
-
injectExtra?: string[];
|
|
22
|
-
}
|
|
23
|
-
declare function UnoCSSAstroIntegration<Theme extends object>(options?: AstroIntegrationConfig<Theme>, defaults?: UserConfigDefaults): AstroIntegration;
|
|
24
|
-
|
|
25
|
-
export { type AstroIntegrationConfig, UnoCSSAstroIntegration as default };
|