@simon_he/pi 0.0.64 → 0.0.66

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 CHANGED
@@ -14041,7 +14041,7 @@ var He = class {
14041
14041
  this.stop.push(x(this.canvas, "mousedown", (a) => {
14042
14042
  o = this.canvas.offsetTop, i = this.canvas.offsetLeft, s = true, this.ctx.beginPath(), this.ctx.moveTo(a.pageX + 2 - i, a.pageY - o);
14043
14043
  }, false)), this.stop.push(x(this.canvas, "mousemove", (a) => {
14044
- s && (this.ctx.lineTo(a.pageX + 2 - i, a.pageY - o), this.ctx.stroke());
14044
+ !s || (this.ctx.lineTo(a.pageX + 2 - i, a.pageY - o), this.ctx.stroke());
14045
14045
  }, false)), this.stop.push(x(this.canvas, "mouseup", () => s = false)), this.stop.push(x(this.canvas, "mouseout", () => s = false)), this.stop.push(x(this.canvas, "touchmove", (a) => {
14046
14046
  this.ctx.lineTo(a.changedTouches[0].pageX + 2 - i, a.changedTouches[0].pageY - o), this.ctx.stroke();
14047
14047
  }, false));
@@ -14102,7 +14102,7 @@ function G(e, t) {
14102
14102
  } }), 1);
14103
14103
  }, a = [], c = window.cancelIdleCallback || clearTimeout, u = s(async function f(p) {
14104
14104
  var d2;
14105
- i && ((p.timeRemaining() > +r || p.didTimeout) && e.length > 0 && a.push((d2 = e.shift()) == null ? void 0 : d2()), e.length > 0 ? s(f) : (o == null || o(a), m()));
14105
+ !i || ((p.timeRemaining() > +r || p.didTimeout) && e.length > 0 && a.push((d2 = e.shift()) == null ? void 0 : d2()), e.length > 0 ? s(f) : (o == null || o(a), m()));
14106
14106
  }, { timeout: n });
14107
14107
  function m() {
14108
14108
  i = false, c(u);
@@ -14358,7 +14358,7 @@ function Qe() {
14358
14358
  return n[o].name;
14359
14359
  return "other";
14360
14360
  };
14361
- return { os: (() => e.match(/compatible/i) || e.match(/Windows/i) ? "windows" : e.match(/Macintosh/i) || e.match(/MacIntel/i) ? "macOS" : e.match(/iphone/i) || e.match(/Ipad/i) ? "ios" : e.match(/android/i) ? "android" : e.match(/Ubuntu/i) ? "Ubuntu" : "other")(), dev: t() };
14361
+ return { os: (() => !!e.match(/compatible/i) || e.match(/Windows/i) ? "windows" : !!e.match(/Macintosh/i) || e.match(/MacIntel/i) ? "macOS" : !!e.match(/iphone/i) || e.match(/Ipad/i) ? "ios" : e.match(/android/i) ? "android" : e.match(/Ubuntu/i) ? "Ubuntu" : "other")(), dev: t() };
14362
14362
  }
14363
14363
  function Ze(e, t = {}, r) {
14364
14364
  let { os: n } = Qe(), o = n === "ios" || n === "android", i = [], s = false;
@@ -14687,7 +14687,7 @@ function Fc(e, t) {
14687
14687
  function Ke(e, t, r) {
14688
14688
  let n = false, o;
14689
14689
  return X(() => o == null ? void 0 : o()), w(e, (i) => {
14690
- r != null && r.root && g(r.root) && (r.root = v(r.root));
14690
+ (r == null ? void 0 : r.root) && g(r.root) && (r.root = v(r.root));
14691
14691
  let s = new IntersectionObserver(t, r);
14692
14692
  s.observe(i), o = () => s.disconnect(), n && o();
14693
14693
  }), () => {
@@ -14782,7 +14782,7 @@ function Cm(e, t) {
14782
14782
  n.push(Se(i, (s) => {
14783
14783
  r = true, s.preventDefault(), s.stopPropagation();
14784
14784
  })), n.push(Se(document, () => {
14785
- r && (r = false, t == null || t());
14785
+ !r || (r = false, t == null || t());
14786
14786
  })), o && n.forEach((s) => s());
14787
14787
  }), () => {
14788
14788
  if (!n.length)
@@ -15522,7 +15522,7 @@ async function yt(e = "./package.json") {
15522
15522
  async function bx() {
15523
15523
  let e = await yt() || {}, { packageManager: t } = e;
15524
15524
  if (t) {
15525
- let r = t.split("@")[0];
15525
+ let r = t.split("@")[0].replace(/[\~\^]/, "");
15526
15526
  if (t)
15527
15527
  return r;
15528
15528
  }
@@ -18098,9 +18098,16 @@ async function getStyle() {
18098
18098
  spinner
18099
18099
  };
18100
18100
  }
18101
+ function getLatestVersion(pkg) {
18102
+ const { status, result } = H(`npm view ${pkg}`, "pipe");
18103
+ if (status === 0)
18104
+ return result.match(/@([^\s]+)/)[1];
18105
+ else
18106
+ throw new Error(result);
18107
+ }
18101
18108
 
18102
18109
  // package.json
18103
- var version = "0.0.64";
18110
+ var version = "0.0.66";
18104
18111
 
18105
18112
  // src/help.ts
18106
18113
  var isZh2 = process.env.PI_Lang === "zh";
@@ -18139,9 +18146,16 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
18139
18146
  var isZh3 = import_process6.default.env.PI_Lang === "zh";
18140
18147
  async function pi(params, pkg, executor = "ni") {
18141
18148
  const text = pkg ? `Installing ${pkg} ...` : "Updating dependency ...";
18142
- const successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
18149
+ const isLatest = executor === "pil";
18150
+ let successMsg = "";
18151
+ if (isLatest) {
18152
+ const version2 = getLatestVersion(pkg);
18153
+ successMsg = pkg ? isZh3 ? `${pkg} \u6700\u65B0\u7248\u672C\uFF1A${version2} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} latest version\uFF1A${version2} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
18154
+ } else {
18155
+ successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
18156
+ }
18143
18157
  const failMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${pkg} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
18144
- const newParams = executor === "pil" ? params : await getParams(params);
18158
+ const newParams = isLatest ? params : await getParams(params);
18145
18159
  let stdio = "pipe";
18146
18160
  let loading_status;
18147
18161
  const { PI_DEFAULT, PI_MaxSockets: sockets } = import_process6.default.env;
package/dist/index.js CHANGED
@@ -14041,7 +14041,7 @@ var He = class {
14041
14041
  this.stop.push(x(this.canvas, "mousedown", (a) => {
14042
14042
  o = this.canvas.offsetTop, i = this.canvas.offsetLeft, s = true, this.ctx.beginPath(), this.ctx.moveTo(a.pageX + 2 - i, a.pageY - o);
14043
14043
  }, false)), this.stop.push(x(this.canvas, "mousemove", (a) => {
14044
- s && (this.ctx.lineTo(a.pageX + 2 - i, a.pageY - o), this.ctx.stroke());
14044
+ !s || (this.ctx.lineTo(a.pageX + 2 - i, a.pageY - o), this.ctx.stroke());
14045
14045
  }, false)), this.stop.push(x(this.canvas, "mouseup", () => s = false)), this.stop.push(x(this.canvas, "mouseout", () => s = false)), this.stop.push(x(this.canvas, "touchmove", (a) => {
14046
14046
  this.ctx.lineTo(a.changedTouches[0].pageX + 2 - i, a.changedTouches[0].pageY - o), this.ctx.stroke();
14047
14047
  }, false));
@@ -14102,7 +14102,7 @@ function G(e, t) {
14102
14102
  } }), 1);
14103
14103
  }, a = [], c = window.cancelIdleCallback || clearTimeout, u = s(async function f(p) {
14104
14104
  var d2;
14105
- i && ((p.timeRemaining() > +r || p.didTimeout) && e.length > 0 && a.push((d2 = e.shift()) == null ? void 0 : d2()), e.length > 0 ? s(f) : (o == null || o(a), m()));
14105
+ !i || ((p.timeRemaining() > +r || p.didTimeout) && e.length > 0 && a.push((d2 = e.shift()) == null ? void 0 : d2()), e.length > 0 ? s(f) : (o == null || o(a), m()));
14106
14106
  }, { timeout: n });
14107
14107
  function m() {
14108
14108
  i = false, c(u);
@@ -14358,7 +14358,7 @@ function Qe() {
14358
14358
  return n[o].name;
14359
14359
  return "other";
14360
14360
  };
14361
- return { os: (() => e.match(/compatible/i) || e.match(/Windows/i) ? "windows" : e.match(/Macintosh/i) || e.match(/MacIntel/i) ? "macOS" : e.match(/iphone/i) || e.match(/Ipad/i) ? "ios" : e.match(/android/i) ? "android" : e.match(/Ubuntu/i) ? "Ubuntu" : "other")(), dev: t() };
14361
+ return { os: (() => !!e.match(/compatible/i) || e.match(/Windows/i) ? "windows" : !!e.match(/Macintosh/i) || e.match(/MacIntel/i) ? "macOS" : !!e.match(/iphone/i) || e.match(/Ipad/i) ? "ios" : e.match(/android/i) ? "android" : e.match(/Ubuntu/i) ? "Ubuntu" : "other")(), dev: t() };
14362
14362
  }
14363
14363
  function Ze(e, t = {}, r) {
14364
14364
  let { os: n } = Qe(), o = n === "ios" || n === "android", i = [], s = false;
@@ -14687,7 +14687,7 @@ function Fc(e, t) {
14687
14687
  function Ke(e, t, r) {
14688
14688
  let n = false, o;
14689
14689
  return X(() => o == null ? void 0 : o()), w(e, (i) => {
14690
- r != null && r.root && g(r.root) && (r.root = v(r.root));
14690
+ (r == null ? void 0 : r.root) && g(r.root) && (r.root = v(r.root));
14691
14691
  let s = new IntersectionObserver(t, r);
14692
14692
  s.observe(i), o = () => s.disconnect(), n && o();
14693
14693
  }), () => {
@@ -14782,7 +14782,7 @@ function Cm(e, t) {
14782
14782
  n.push(Se(i, (s) => {
14783
14783
  r = true, s.preventDefault(), s.stopPropagation();
14784
14784
  })), n.push(Se(document, () => {
14785
- r && (r = false, t == null || t());
14785
+ !r || (r = false, t == null || t());
14786
14786
  })), o && n.forEach((s) => s());
14787
14787
  }), () => {
14788
14788
  if (!n.length)
@@ -15522,7 +15522,7 @@ async function yt(e = "./package.json") {
15522
15522
  async function bx() {
15523
15523
  let e = await yt() || {}, { packageManager: t } = e;
15524
15524
  if (t) {
15525
- let r = t.split("@")[0];
15525
+ let r = t.split("@")[0].replace(/[\~\^]/, "");
15526
15526
  if (t)
15527
15527
  return r;
15528
15528
  }
@@ -18098,9 +18098,16 @@ async function getStyle() {
18098
18098
  spinner
18099
18099
  };
18100
18100
  }
18101
+ function getLatestVersion(pkg) {
18102
+ const { status, result } = H(`npm view ${pkg}`, "pipe");
18103
+ if (status === 0)
18104
+ return result.match(/@([^\s]+)/)[1];
18105
+ else
18106
+ throw new Error(result);
18107
+ }
18101
18108
 
18102
18109
  // package.json
18103
- var version = "0.0.64";
18110
+ var version = "0.0.66";
18104
18111
 
18105
18112
  // src/help.ts
18106
18113
  var isZh2 = process.env.PI_Lang === "zh";
@@ -18139,9 +18146,16 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
18139
18146
  var isZh3 = process9.env.PI_Lang === "zh";
18140
18147
  async function pi(params, pkg, executor = "ni") {
18141
18148
  const text = pkg ? `Installing ${pkg} ...` : "Updating dependency ...";
18142
- const successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
18149
+ const isLatest = executor === "pil";
18150
+ let successMsg = "";
18151
+ if (isLatest) {
18152
+ const version2 = getLatestVersion(pkg);
18153
+ successMsg = pkg ? isZh3 ? `${pkg} \u6700\u65B0\u7248\u672C\uFF1A${version2} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} latest version\uFF1A${version2} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
18154
+ } else {
18155
+ successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
18156
+ }
18143
18157
  const failMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${pkg} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
18144
- const newParams = executor === "pil" ? params : await getParams(params);
18158
+ const newParams = isLatest ? params : await getParams(params);
18145
18159
  let stdio = "pipe";
18146
18160
  let loading_status;
18147
18161
  const { PI_DEFAULT, PI_MaxSockets: sockets } = process9.env;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simon_he/pi",
3
3
  "type": "module",
4
- "version": "0.0.64",
4
+ "version": "0.0.66",
5
5
  "description": "",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
@@ -70,7 +70,7 @@
70
70
  "bumpp": "^8.2.1",
71
71
  "eslint": "^8.29.0",
72
72
  "esno": "^0.16.3",
73
- "lazy-js-utils": "^0.0.65",
73
+ "lazy-js-utils": "latest",
74
74
  "lint-staged": "^13.1.0",
75
75
  "ora": "^6.1.2",
76
76
  "picocolors": "^1.0.0",