@simon_he/pi 0.0.66 → 0.0.68
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 +27 -17
- package/dist/index.js +27 -17
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -3347,12 +3347,12 @@ var require_format_normaliser = __commonJS({
|
|
|
3347
3347
|
let pxPos = 0;
|
|
3348
3348
|
for (let y = 0; y < height; y++) {
|
|
3349
3349
|
for (let x2 = 0; x2 < width; x2++) {
|
|
3350
|
-
let
|
|
3351
|
-
if (!
|
|
3350
|
+
let color3 = palette[indata[pxPos]];
|
|
3351
|
+
if (!color3) {
|
|
3352
3352
|
throw new Error("index " + indata[pxPos] + " not in palette");
|
|
3353
3353
|
}
|
|
3354
3354
|
for (let i = 0; i < 4; i++) {
|
|
3355
|
-
outdata[pxPos + i] =
|
|
3355
|
+
outdata[pxPos + i] = color3[i];
|
|
3356
3356
|
}
|
|
3357
3357
|
pxPos += 4;
|
|
3358
3358
|
}
|
|
@@ -4791,9 +4791,9 @@ var require_terminal2 = __commonJS({
|
|
|
4791
4791
|
var require_svg_tag = __commonJS({
|
|
4792
4792
|
"node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
|
|
4793
4793
|
var Utils = require_utils2();
|
|
4794
|
-
function getColorAttrib(
|
|
4795
|
-
const alpha =
|
|
4796
|
-
const str = attrib + '="' +
|
|
4794
|
+
function getColorAttrib(color3, attrib) {
|
|
4795
|
+
const alpha = color3.a / 255;
|
|
4796
|
+
const str = attrib + '="' + color3.hex + '"';
|
|
4797
4797
|
return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
|
|
4798
4798
|
}
|
|
4799
4799
|
function svgCmd(cmd, x2, y) {
|
|
@@ -18083,18 +18083,18 @@ async function getParams(params) {
|
|
|
18083
18083
|
}
|
|
18084
18084
|
}
|
|
18085
18085
|
async function loading(text) {
|
|
18086
|
-
const { color:
|
|
18086
|
+
const { color: color3, spinner } = await getStyle();
|
|
18087
18087
|
return ora({
|
|
18088
18088
|
text,
|
|
18089
18089
|
spinner,
|
|
18090
|
-
color:
|
|
18090
|
+
color: color3,
|
|
18091
18091
|
discardStdin: true
|
|
18092
18092
|
}).start();
|
|
18093
18093
|
}
|
|
18094
18094
|
async function getStyle() {
|
|
18095
|
-
const { PI_COLOR:
|
|
18095
|
+
const { PI_COLOR: color3 = "yellow", PI_SPINNER: spinner = "star" } = process.env;
|
|
18096
18096
|
return {
|
|
18097
|
-
color:
|
|
18097
|
+
color: color3,
|
|
18098
18098
|
spinner
|
|
18099
18099
|
};
|
|
18100
18100
|
}
|
|
@@ -18107,7 +18107,7 @@ function getLatestVersion(pkg) {
|
|
|
18107
18107
|
}
|
|
18108
18108
|
|
|
18109
18109
|
// package.json
|
|
18110
|
-
var version = "0.0.
|
|
18110
|
+
var version = "0.0.68";
|
|
18111
18111
|
|
|
18112
18112
|
// src/help.ts
|
|
18113
18113
|
var isZh2 = process.env.PI_Lang === "zh";
|
|
@@ -18135,9 +18135,6 @@ async function installDeps() {
|
|
|
18135
18135
|
const { status: hasNi } = H("ni -v", "pipe");
|
|
18136
18136
|
if (hasNi === 1)
|
|
18137
18137
|
await H("npm i -g @antfu/ni", "pipe");
|
|
18138
|
-
const { status: hasCcommand } = H("ccommand -v", "pipe");
|
|
18139
|
-
if (hasCcommand === 1)
|
|
18140
|
-
await H("npm i -g ccommand", "pipe");
|
|
18141
18138
|
}
|
|
18142
18139
|
|
|
18143
18140
|
// src/pi.ts
|
|
@@ -18147,6 +18144,7 @@ var isZh3 = import_process6.default.env.PI_Lang === "zh";
|
|
|
18147
18144
|
async function pi(params, pkg, executor = "ni") {
|
|
18148
18145
|
const text = pkg ? `Installing ${pkg} ...` : "Updating dependency ...";
|
|
18149
18146
|
const isLatest = executor === "pil";
|
|
18147
|
+
const start = Date.now();
|
|
18150
18148
|
let successMsg = "";
|
|
18151
18149
|
if (isLatest) {
|
|
18152
18150
|
const version2 = getLatestVersion(pkg);
|
|
@@ -18181,6 +18179,9 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
18181
18179
|
});
|
|
18182
18180
|
if (stdio === "inherit")
|
|
18183
18181
|
loading_status = await loading("");
|
|
18182
|
+
const end = Date.now();
|
|
18183
|
+
const costTime = (end - start) / 1e3;
|
|
18184
|
+
successMsg += import_picocolors2.default.blue(` ---- \u23F0\uFF1A${costTime}s`);
|
|
18184
18185
|
if (status === 0) {
|
|
18185
18186
|
loading_status.succeed(import_picocolors2.default.green(successMsg));
|
|
18186
18187
|
} else if (result && result.includes("Not Found - 404")) {
|
|
@@ -18266,8 +18267,9 @@ async function pix(params) {
|
|
|
18266
18267
|
}
|
|
18267
18268
|
|
|
18268
18269
|
// src/prun.ts
|
|
18270
|
+
var import_ccommand = require("ccommand");
|
|
18269
18271
|
function prun(params) {
|
|
18270
|
-
return
|
|
18272
|
+
return (0, import_ccommand.ccommand)(params);
|
|
18271
18273
|
}
|
|
18272
18274
|
|
|
18273
18275
|
// src/pu.ts
|
|
@@ -18280,14 +18282,22 @@ var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
|
18280
18282
|
var isZh4 = process.env.PI_Lang === "zh";
|
|
18281
18283
|
async function pui(params, pkg) {
|
|
18282
18284
|
const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
|
|
18283
|
-
const
|
|
18285
|
+
const start = Date.now();
|
|
18286
|
+
let successMsg = isZh4 ? `${pkg}\u5378\u8F7D\u6210\u529F! \u{1F60A}` : `UnInstalled ${pkg} successfully! \u{1F60A}`;
|
|
18284
18287
|
const failMsg = isZh4 ? `${pkg}\u5378\u8F7D\u5931\u8D25 \u{1F62D}` : `Failed to uninstall ${pkg} \u{1F62D}`;
|
|
18285
18288
|
if (!pkg) {
|
|
18286
|
-
console.log(
|
|
18289
|
+
console.log(
|
|
18290
|
+
import_picocolors3.default.yellow(
|
|
18291
|
+
isZh4 ? "\u9700\u8981\u6307\u5B9A\u8981\u5378\u8F7D\u7684\u5305\u540D\uFF01" : "Need to specify an uninstall package name!"
|
|
18292
|
+
)
|
|
18293
|
+
);
|
|
18287
18294
|
process.exit(1);
|
|
18288
18295
|
}
|
|
18289
18296
|
const loading_status = await loading(text);
|
|
18290
18297
|
const { status, result } = await Rx(`nun ${params}`);
|
|
18298
|
+
const end = Date.now();
|
|
18299
|
+
const costTime = (end - start) / 1e3;
|
|
18300
|
+
successMsg += import_picocolors3.default.blue(` ---- \u23F0\uFF1A${costTime}s`);
|
|
18291
18301
|
if (status === 0)
|
|
18292
18302
|
loading_status.succeed(import_picocolors3.default.green(successMsg));
|
|
18293
18303
|
else
|
package/dist/index.js
CHANGED
|
@@ -3352,12 +3352,12 @@ var require_format_normaliser = __commonJS({
|
|
|
3352
3352
|
let pxPos = 0;
|
|
3353
3353
|
for (let y = 0; y < height; y++) {
|
|
3354
3354
|
for (let x2 = 0; x2 < width; x2++) {
|
|
3355
|
-
let
|
|
3356
|
-
if (!
|
|
3355
|
+
let color3 = palette[indata[pxPos]];
|
|
3356
|
+
if (!color3) {
|
|
3357
3357
|
throw new Error("index " + indata[pxPos] + " not in palette");
|
|
3358
3358
|
}
|
|
3359
3359
|
for (let i = 0; i < 4; i++) {
|
|
3360
|
-
outdata[pxPos + i] =
|
|
3360
|
+
outdata[pxPos + i] = color3[i];
|
|
3361
3361
|
}
|
|
3362
3362
|
pxPos += 4;
|
|
3363
3363
|
}
|
|
@@ -4796,9 +4796,9 @@ var require_terminal2 = __commonJS({
|
|
|
4796
4796
|
var require_svg_tag = __commonJS({
|
|
4797
4797
|
"node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {
|
|
4798
4798
|
var Utils = require_utils2();
|
|
4799
|
-
function getColorAttrib(
|
|
4800
|
-
const alpha =
|
|
4801
|
-
const str = attrib + '="' +
|
|
4799
|
+
function getColorAttrib(color3, attrib) {
|
|
4800
|
+
const alpha = color3.a / 255;
|
|
4801
|
+
const str = attrib + '="' + color3.hex + '"';
|
|
4802
4802
|
return alpha < 1 ? str + " " + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str;
|
|
4803
4803
|
}
|
|
4804
4804
|
function svgCmd(cmd, x2, y) {
|
|
@@ -18083,18 +18083,18 @@ async function getParams(params) {
|
|
|
18083
18083
|
}
|
|
18084
18084
|
}
|
|
18085
18085
|
async function loading(text) {
|
|
18086
|
-
const { color:
|
|
18086
|
+
const { color: color3, spinner } = await getStyle();
|
|
18087
18087
|
return ora({
|
|
18088
18088
|
text,
|
|
18089
18089
|
spinner,
|
|
18090
|
-
color:
|
|
18090
|
+
color: color3,
|
|
18091
18091
|
discardStdin: true
|
|
18092
18092
|
}).start();
|
|
18093
18093
|
}
|
|
18094
18094
|
async function getStyle() {
|
|
18095
|
-
const { PI_COLOR:
|
|
18095
|
+
const { PI_COLOR: color3 = "yellow", PI_SPINNER: spinner = "star" } = process.env;
|
|
18096
18096
|
return {
|
|
18097
|
-
color:
|
|
18097
|
+
color: color3,
|
|
18098
18098
|
spinner
|
|
18099
18099
|
};
|
|
18100
18100
|
}
|
|
@@ -18107,7 +18107,7 @@ function getLatestVersion(pkg) {
|
|
|
18107
18107
|
}
|
|
18108
18108
|
|
|
18109
18109
|
// package.json
|
|
18110
|
-
var version = "0.0.
|
|
18110
|
+
var version = "0.0.68";
|
|
18111
18111
|
|
|
18112
18112
|
// src/help.ts
|
|
18113
18113
|
var isZh2 = process.env.PI_Lang === "zh";
|
|
@@ -18135,9 +18135,6 @@ async function installDeps() {
|
|
|
18135
18135
|
const { status: hasNi } = H("ni -v", "pipe");
|
|
18136
18136
|
if (hasNi === 1)
|
|
18137
18137
|
await H("npm i -g @antfu/ni", "pipe");
|
|
18138
|
-
const { status: hasCcommand } = H("ccommand -v", "pipe");
|
|
18139
|
-
if (hasCcommand === 1)
|
|
18140
|
-
await H("npm i -g ccommand", "pipe");
|
|
18141
18138
|
}
|
|
18142
18139
|
|
|
18143
18140
|
// src/pi.ts
|
|
@@ -18147,6 +18144,7 @@ var isZh3 = process9.env.PI_Lang === "zh";
|
|
|
18147
18144
|
async function pi(params, pkg, executor = "ni") {
|
|
18148
18145
|
const text = pkg ? `Installing ${pkg} ...` : "Updating dependency ...";
|
|
18149
18146
|
const isLatest = executor === "pil";
|
|
18147
|
+
const start = Date.now();
|
|
18150
18148
|
let successMsg = "";
|
|
18151
18149
|
if (isLatest) {
|
|
18152
18150
|
const version2 = getLatestVersion(pkg);
|
|
@@ -18181,6 +18179,9 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
18181
18179
|
});
|
|
18182
18180
|
if (stdio === "inherit")
|
|
18183
18181
|
loading_status = await loading("");
|
|
18182
|
+
const end = Date.now();
|
|
18183
|
+
const costTime = (end - start) / 1e3;
|
|
18184
|
+
successMsg += import_picocolors2.default.blue(` ---- \u23F0\uFF1A${costTime}s`);
|
|
18184
18185
|
if (status === 0) {
|
|
18185
18186
|
loading_status.succeed(import_picocolors2.default.green(successMsg));
|
|
18186
18187
|
} else if (result && result.includes("Not Found - 404")) {
|
|
@@ -18266,8 +18267,9 @@ async function pix(params) {
|
|
|
18266
18267
|
}
|
|
18267
18268
|
|
|
18268
18269
|
// src/prun.ts
|
|
18270
|
+
import { ccommand } from "ccommand";
|
|
18269
18271
|
function prun(params) {
|
|
18270
|
-
return
|
|
18272
|
+
return ccommand(params);
|
|
18271
18273
|
}
|
|
18272
18274
|
|
|
18273
18275
|
// src/pu.ts
|
|
@@ -18280,14 +18282,22 @@ var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
|
18280
18282
|
var isZh4 = process.env.PI_Lang === "zh";
|
|
18281
18283
|
async function pui(params, pkg) {
|
|
18282
18284
|
const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
|
|
18283
|
-
const
|
|
18285
|
+
const start = Date.now();
|
|
18286
|
+
let successMsg = isZh4 ? `${pkg}\u5378\u8F7D\u6210\u529F! \u{1F60A}` : `UnInstalled ${pkg} successfully! \u{1F60A}`;
|
|
18284
18287
|
const failMsg = isZh4 ? `${pkg}\u5378\u8F7D\u5931\u8D25 \u{1F62D}` : `Failed to uninstall ${pkg} \u{1F62D}`;
|
|
18285
18288
|
if (!pkg) {
|
|
18286
|
-
console.log(
|
|
18289
|
+
console.log(
|
|
18290
|
+
import_picocolors3.default.yellow(
|
|
18291
|
+
isZh4 ? "\u9700\u8981\u6307\u5B9A\u8981\u5378\u8F7D\u7684\u5305\u540D\uFF01" : "Need to specify an uninstall package name!"
|
|
18292
|
+
)
|
|
18293
|
+
);
|
|
18287
18294
|
process.exit(1);
|
|
18288
18295
|
}
|
|
18289
18296
|
const loading_status = await loading(text);
|
|
18290
18297
|
const { status, result } = await Rx(`nun ${params}`);
|
|
18298
|
+
const end = Date.now();
|
|
18299
|
+
const costTime = (end - start) / 1e3;
|
|
18300
|
+
successMsg += import_picocolors3.default.blue(` ---- \u23F0\uFF1A${costTime}s`);
|
|
18291
18301
|
if (status === 0)
|
|
18292
18302
|
loading_status.succeed(import_picocolors3.default.green(successMsg));
|
|
18293
18303
|
else
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon_he/pi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.68",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,6 +62,8 @@
|
|
|
62
62
|
"typecheck": "tsc --noEmit"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"build": "^0.1.4",
|
|
66
|
+
"ccommand": "^1.0.49",
|
|
65
67
|
"fast-glob": "^3.3.1"
|
|
66
68
|
},
|
|
67
69
|
"devDependencies": {
|