@moewolf/moe-icons-cli 0.0.25 → 0.0.26
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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CliError } from "../errors/index.js";
|
|
2
|
+
/** Wait for a bounded interval and detach the abort listener on either outcome. */
|
|
3
|
+
export function abortableSleep(milliseconds, signal) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
if (signal?.aborted) {
|
|
6
|
+
reject(new CliError("CANCELLED", "login cancelled"));
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const onAbort = () => {
|
|
10
|
+
clearTimeout(timer);
|
|
11
|
+
signal?.removeEventListener("abort", onAbort);
|
|
12
|
+
reject(new CliError("CANCELLED", "login cancelled"));
|
|
13
|
+
};
|
|
14
|
+
const timer = setTimeout(() => {
|
|
15
|
+
signal?.removeEventListener("abort", onAbort);
|
|
16
|
+
resolve();
|
|
17
|
+
}, milliseconds);
|
|
18
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
19
|
+
});
|
|
20
|
+
}
|
package/dist/core/auth.js
CHANGED
|
@@ -5,6 +5,7 @@ import { requestJson } from "../api/client.js";
|
|
|
5
5
|
import { selectedStore, rememberFileStore, stateRoot } from "../auth/session-policy.cjs";
|
|
6
6
|
import { resolve } from "node:path";
|
|
7
7
|
import { boundedResponse } from "../auth/transport.js";
|
|
8
|
+
import { abortableSleep } from "../auth/abortable-sleep.js";
|
|
8
9
|
import { CliError } from "../errors/index.js";
|
|
9
10
|
const DEFAULT_API_BASE_URL = "https://api.moeicons.com";
|
|
10
11
|
const DEFAULT_WEBSITE_ORIGIN = "https://moeicons.com";
|
|
@@ -173,10 +174,7 @@ export async function runLoginUseCase(context, deps = {}) {
|
|
|
173
174
|
const session = await loginWithDeviceSession(auth0Config(context), {
|
|
174
175
|
request,
|
|
175
176
|
openBrowser: browserOpener,
|
|
176
|
-
sleep: deps.sleep ??
|
|
177
|
-
const timer = setTimeout(resolve, milliseconds);
|
|
178
|
-
signal?.addEventListener("abort", () => { clearTimeout(timer); reject(new CliError("CANCELLED", "login cancelled")); }, { once: true });
|
|
179
|
-
})),
|
|
177
|
+
sleep: deps.sleep ?? abortableSleep,
|
|
180
178
|
tokenStore,
|
|
181
179
|
now: () => context.now().getTime(),
|
|
182
180
|
}, context.signal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moewolf/moe-icons-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Moeicons CLI: install React, Vue, Vanilla, or Assets icon targets, manage releases and login, and expose an MCP server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"fflate": "^0.8.2",
|
|
75
75
|
"jsonc-parser": "^3.3.1"
|
|
76
76
|
},
|
|
77
|
-
"payloadHash": "
|
|
77
|
+
"payloadHash": "7cf47fc30af78067ebffe38ade5eb2e143d27b923d385dab21fe9cf6e6c28ac7"
|
|
78
78
|
}
|