@pikacss/plugin-icons 0.0.31 → 0.0.32
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 +47 -1
- package/dist/index.mjs +19 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,55 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
let node_process = require("node:process");
|
|
29
|
+
node_process = __toESM(node_process);
|
|
1
30
|
let __iconify_utils = require("@iconify/utils");
|
|
2
31
|
let __pikacss_core = require("@pikacss/core");
|
|
3
32
|
let __unocss_preset_icons = require("@unocss/preset-icons");
|
|
4
33
|
let ofetch = require("ofetch");
|
|
5
34
|
|
|
6
35
|
//#region src/index.ts
|
|
36
|
+
/**
|
|
37
|
+
* Environment flags helper function to detect the current runtime environment.
|
|
38
|
+
* This replaces the removed `getEnvFlags` export from `@unocss/preset-icons` v66+.
|
|
39
|
+
*
|
|
40
|
+
* @returns An object containing:
|
|
41
|
+
* - `isNode`: Whether the code is running in a Node.js environment
|
|
42
|
+
* - `isVSCode`: Whether the code is running within VS Code (extension host)
|
|
43
|
+
* - `isESLint`: Whether the code is running within ESLint
|
|
44
|
+
*/
|
|
45
|
+
function getEnvFlags() {
|
|
46
|
+
const isNode = typeof node_process.default !== "undefined" && typeof node_process.default.versions?.node !== "undefined";
|
|
47
|
+
return {
|
|
48
|
+
isNode,
|
|
49
|
+
isVSCode: isNode && !!node_process.default.env.VSCODE_PID,
|
|
50
|
+
isESLint: isNode && !!node_process.default.env.ESLINT
|
|
51
|
+
};
|
|
52
|
+
}
|
|
7
53
|
function icons() {
|
|
8
54
|
return createIconsPlugin(createIconsLoader);
|
|
9
55
|
}
|
|
@@ -13,7 +59,7 @@ function createCDNLoader(cdnBase) {
|
|
|
13
59
|
async function createIconsLoader(config) {
|
|
14
60
|
const { cdn } = config;
|
|
15
61
|
const loaders = [];
|
|
16
|
-
const { isNode, isVSCode, isESLint } =
|
|
62
|
+
const { isNode, isVSCode, isESLint } = getEnvFlags();
|
|
17
63
|
if (isNode && !isVSCode && !isESLint) {
|
|
18
64
|
const nodeLoader = await (0, __unocss_preset_icons.createNodeLoader)();
|
|
19
65
|
if (nodeLoader != null) loaders.push(nodeLoader);
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
|
+
import process from "node:process";
|
|
1
2
|
import { encodeSvgForCss, loadIcon } from "@iconify/utils";
|
|
2
3
|
import { defineEnginePlugin, warn } from "@pikacss/core";
|
|
3
|
-
import { combineLoaders, createCDNFetchLoader, createNodeLoader,
|
|
4
|
+
import { combineLoaders, createCDNFetchLoader, createNodeLoader, parseIconWithLoader } from "@unocss/preset-icons";
|
|
4
5
|
import { $fetch } from "ofetch";
|
|
5
6
|
|
|
6
7
|
//#region src/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* Environment flags helper function to detect the current runtime environment.
|
|
10
|
+
* This replaces the removed `getEnvFlags` export from `@unocss/preset-icons` v66+.
|
|
11
|
+
*
|
|
12
|
+
* @returns An object containing:
|
|
13
|
+
* - `isNode`: Whether the code is running in a Node.js environment
|
|
14
|
+
* - `isVSCode`: Whether the code is running within VS Code (extension host)
|
|
15
|
+
* - `isESLint`: Whether the code is running within ESLint
|
|
16
|
+
*/
|
|
17
|
+
function getEnvFlags() {
|
|
18
|
+
const isNode = typeof process !== "undefined" && typeof process.versions?.node !== "undefined";
|
|
19
|
+
return {
|
|
20
|
+
isNode,
|
|
21
|
+
isVSCode: isNode && !!process.env.VSCODE_PID,
|
|
22
|
+
isESLint: isNode && !!process.env.ESLINT
|
|
23
|
+
};
|
|
24
|
+
}
|
|
7
25
|
function icons() {
|
|
8
26
|
return createIconsPlugin(createIconsLoader);
|
|
9
27
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0.
|
|
7
|
+
"version": "0.0.32",
|
|
8
8
|
"author": "DevilTea <ch19980814@gmail.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@iconify/utils": "^
|
|
39
|
-
"@unocss/preset-icons": "^
|
|
38
|
+
"@iconify/utils": "^3.1.0",
|
|
39
|
+
"@unocss/preset-icons": "^66.5.9",
|
|
40
40
|
"ofetch": "^1.5.1",
|
|
41
|
-
"@pikacss/core": "0.0.
|
|
41
|
+
"@pikacss/core": "0.0.32"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsdown",
|