New:Socket for Asana Is Now Available.Learn more
Get Started

@0disoft/laqu

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0disoft/laqu - npm Package Compare versions

Comparing version
1.0.4
to
1.0.5
+1
-1
dist/output-coordinator.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"output-coordinator.d.ts","sourceRoot":"","sources":["../src/output-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,qBAAa,aAAa;IACxB,MAAM,UAAS;IACf,iBAAiB,SAAK;IACtB,gBAAgB,SAAK;IACrB,kBAAkB,UAAS;IAC3B,UAAU,SAAK;IACf,WAAW,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,SAAS,CAAC;IACvD,YAAY,EAAE,KAAK,GAAG,SAAS,CAAC;IAChC,oBAAoB,UAAS;IAC7B,aAAa,EAAE,SAAS,MAAM,EAAE,CAAM;CACvC;AAED,qBAAa,iBAAiB;;IAS1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAZxC,QAAQ,CAAC,KAAK,gBAAuB;gBAQlB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,OAAO,EACb,iBAAiB,GAAE,iBAA0B,EAC7C,qBAAqB,SAAQ;IAGhD,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAOvC,UAAU,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,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAOnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA6I7B"}

@@ -83,2 +83,3 @@ export class TerminalLease {

}
await this.flush();
}

@@ -207,5 +208,18 @@ this.lease.closed = true;

function mergePendingFrame(previous, next) {
if (previous === undefined) {
return next;
}
if (previous?.kind === "json" && next.kind === "json") {
return { kind: "json", events: [...previous.events, ...next.events] };
}
if (previous.kind === "plain" && next.kind === "plain") {
return { kind: "plain", lines: [...previous.lines, ...next.lines] };
}
if (previous.kind === "live" && next.kind === "live") {
return {
kind: "live",
scrollbackLines: [...previous.scrollbackLines, ...next.scrollbackLines],
lines: next.lines,
};
}
return next;

@@ -212,0 +226,0 @@ }

@@ -222,2 +222,5 @@ import { logEvent, summaryEvent, taskEvent } from "./events.js";

function progressText(task, theme) {
if (task.progress.kind === "indeterminate") {
return theme.tokens.progressIndeterminate;
}
if (task.aggregate.kind === "ratio") {

@@ -224,0 +227,0 @@ const percent = Math.round(task.aggregate.ratio * 100);

@@ -1,1 +0,1 @@

{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,eAAe,EAEf,cAAc,EAKf,MAAM,YAAY,CAAC;AASpB,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,eAAe,CAExE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,cAAmB,GAAG,eAAe,CAoCnF"}
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,eAAe,EAEf,cAAc,EAKf,MAAM,YAAY,CAAC;AASpB,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,eAAe,CAExE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,cAAmB,GAAG,eAAe,CAsCnF"}

@@ -16,2 +16,4 @@ import { OutputCoordinator } from "./output-coordinator.js";

const theme = compileTheme({ useColor: defaultUseColor(capability, env), ...options.theme });
const columns = normalizedColumns(stderr.columns);
const maxRows = validatedPositiveSafeInteger(options.maxRows ?? 12, "maxRows");
const rendererOptions = {

@@ -22,4 +24,4 @@ format: options.format ?? "human",

theme,
columns: stderr.columns ?? 80,
maxRows: options.maxRows ?? 12,
columns,
maxRows,
};

@@ -67,7 +69,2 @@ const initialDecision = chooseRenderer(rendererOptions);

const handle = this.createTask(title, options);
const onAbort = () => handle.cancel("aborted");
options.signal?.addEventListener("abort", onAbort, { once: true });
if (options.signal?.aborted === true) {
handle.cancel("aborted");
}
try {

@@ -84,3 +81,3 @@ const result = await callback(handle);

else {
const message = error instanceof Error ? error.message : undefined;
const message = unknownToMessage(error);
this.store.forceTerminalUpdate(handle.id, { status: "failed", message });

@@ -93,3 +90,2 @@ }

finally {
options.signal?.removeEventListener("abort", onAbort);
await this.flush();

@@ -102,2 +98,3 @@ }

const handle = new StoreTaskHandle(id, this.store, (immediate) => this.markDirty(immediate), () => this.#assertAcceptsMutations());
handle.bindSignal(options.signal);
this.markDirty(true);

@@ -225,2 +222,3 @@ return handle;

assertWritable;
#abortCleanup;
constructor(id, store, onChange, assertWritable) {

@@ -232,5 +230,19 @@ this.id = id;

}
bindSignal(signal) {
if (signal === undefined) {
return;
}
if (signal.aborted) {
this.cancel("aborted");
return;
}
const onAbort = () => this.cancel("aborted");
signal.addEventListener("abort", onAbort, { once: true });
this.#abortCleanup = () => signal.removeEventListener("abort", onAbort);
}
setTotal(total) {
this.assertWritable();
this.store.update(this.id, { progress: setTotalProgress(total) });
this.store.update(this.id, {
progress: setTotalProgress(total, currentProgressValue(this.store.getProgress(this.id))),
});
this.onChange(false);

@@ -262,3 +274,6 @@ }

this.assertWritable();
this.store.update(this.id, { progress: { kind: "indeterminate" }, message });
this.store.update(this.id, {
progress: { kind: "indeterminate" },
...(message === undefined ? {} : { message }),
});
this.onChange(false);

@@ -278,3 +293,7 @@ }

this.assertWritable();
this.store.update(this.id, { status: "succeeded", message });
this.store.update(this.id, {
status: "succeeded",
...(message === undefined ? {} : { message }),
});
this.#disposeAbortCleanup();
this.onChange(true);

@@ -284,4 +303,8 @@ }

this.assertWritable();
const message = error instanceof Error ? error.message : undefined;
this.store.update(this.id, { status: "failed", message });
const message = unknownToMessage(error);
this.store.update(this.id, {
status: "failed",
...(message === undefined ? {} : { message }),
});
this.#disposeAbortCleanup();
this.onChange(true);

@@ -291,3 +314,7 @@ }

this.assertWritable();
this.store.update(this.id, { status: "cancelled", message });
this.store.update(this.id, {
status: "cancelled",
...(message === undefined ? {} : { message }),
});
this.#disposeAbortCleanup();
this.onChange(true);

@@ -299,4 +326,10 @@ }

this.onChange(true);
return new StoreTaskHandle(id, this.store, this.onChange, this.assertWritable);
const handle = new StoreTaskHandle(id, this.store, this.onChange, this.assertWritable);
handle.bindSignal(options.signal);
return handle;
}
#disposeAbortCleanup() {
this.#abortCleanup?.();
this.#abortCleanup = undefined;
}
}

@@ -316,2 +349,5 @@ function detectCapability(stream, env) {

}
if (env.FORCE_COLOR === "0") {
return false;
}
if (env.FORCE_COLOR !== undefined && env.FORCE_COLOR !== "0") {

@@ -322,2 +358,49 @@ return true;

}
function currentProgressValue(progress) {
switch (progress.kind) {
case "counter":
case "determinate":
return progress.current;
case "indeterminate":
case "none":
case "ratio":
return 0;
}
}
function normalizedColumns(columns) {
if (typeof columns === "number" && Number.isSafeInteger(columns) && columns > 0) {
return columns;
}
return 80;
}
function validatedPositiveSafeInteger(value, name) {
if (!Number.isSafeInteger(value) || value <= 0) {
throw new TypeError(`${name} must be a safe positive integer`);
}
return value;
}
function unknownToMessage(error) {
if (error === undefined) {
return undefined;
}
if (error instanceof Error) {
return error.message;
}
if (typeof error === "string") {
return error;
}
if (error === null ||
typeof error === "number" ||
typeof error === "boolean" ||
typeof error === "bigint" ||
typeof error === "symbol") {
return String(error);
}
try {
return JSON.stringify(error) ?? String(error);
}
catch {
return String(error);
}
}
function acquireLiveStreamLease(stream) {

@@ -324,0 +407,0 @@ if (liveStreamLeases.has(stream)) {

@@ -292,2 +292,5 @@ export class TaskStore {

for (const child of children) {
if (child.weight === 0) {
continue;
}
if (child.aggregate.kind === "mixed" || child.aggregate.kind === "none") {

@@ -294,0 +297,0 @@ return { kind: "mixed" };

@@ -1,1 +0,1 @@

{"version":3,"file":"width.d.ts","sourceRoot":"","sources":["../src/width.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAUtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAkBvD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAW9E;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,MAAM,CAkCR;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,MAAM,EAAE,CAoCV"}
{"version":3,"file":"width.d.ts","sourceRoot":"","sources":["../src/width.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAyBtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,CAkBvD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAW9E;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,MAAM,CAuCR;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,MAAM,EAAE,CAoCV"}
// CSI, OSC, and common one-byte ESC sequences.
const ansiPattern = new RegExp(String.raw `\u001b(?:\[[0-?]*[ -/]*[@-~]|\][^\u0007]*(?:\u0007|\u001b\\)|[@-Z\\-_])`, "g");
const resetSequence = "\u001b[0m";
const unsafeControlPattern = new RegExp(String.raw `[\u0000-\u0008\u000a-\u001f\u007f-\u009f]`, "g");

@@ -49,3 +50,6 @@ const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });

}
const marker = options.overflowMarker ?? "";
const requestedMarker = options.overflowMarker ?? "";
const marker = displayWidth(requestedMarker, options) > columns
? truncateToColumns(requestedMarker, columns, { ...options, overflowMarker: "" })
: requestedMarker;
const markerWidth = displayWidth(marker, options);

@@ -74,3 +78,4 @@ const target = marker === "" ? columns : Math.max(0, columns - markerWidth);

}
return truncated ? `${output}${marker}` : output;
const result = truncated ? `${output}${marker}` : output;
return needsSgrReset(result) ? `${result}${resetSequence}` : result;
}

@@ -154,2 +159,4 @@ export function wrapToColumns(input, columns, options = {}) {

(codePoint >= 0x20d0 && codePoint <= 0x20ff) ||
(codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||
(codePoint >= 0xe0100 && codePoint <= 0xe01ef) ||
(codePoint >= 0xfe20 && codePoint <= 0xfe2f));

@@ -168,3 +175,4 @@ }

(codePoint >= 0xff00 && codePoint <= 0xff60) ||
(codePoint >= 0xffe0 && codePoint <= 0xffe6)));
(codePoint >= 0xffe0 && codePoint <= 0xffe6) ||
(codePoint >= 0x20000 && codePoint <= 0x3fffd)));
}

@@ -177,1 +185,152 @@ function isAmbiguous(codePoint) {

}
function needsSgrReset(input) {
const state = emptySgrState();
for (const token of tokenizeAnsi(input)) {
if (token.kind !== "ansi" || !token.value.startsWith("\u001b[") || !token.value.endsWith("m")) {
continue;
}
applySgrSequence(state, token.value);
}
return isSgrActive(state);
}
function applySgrSequence(state, sequence) {
const body = sequence.slice(2, -1);
const params = body === "" ? [0] : body.split(/[;:]/).map((part) => Number(part || 0));
for (const param of params) {
applySgrParam(state, param);
}
}
function applySgrParam(state, param) {
if (param === 0) {
resetSgrState(state);
return;
}
if (param === 1 || param === 2) {
state.intensity = true;
return;
}
if (param === 3) {
state.italic = true;
return;
}
if (param === 4 || param === 21) {
state.underline = true;
return;
}
if (param === 5 || param === 6) {
state.blink = true;
return;
}
if (param === 7) {
state.inverse = true;
return;
}
if (param === 8) {
state.conceal = true;
return;
}
if (param === 9) {
state.strike = true;
return;
}
if (param === 53) {
state.overline = true;
return;
}
if (param === 38 || (param >= 30 && param <= 37) || (param >= 90 && param <= 97)) {
state.foreground = true;
return;
}
if (param === 48 || (param >= 40 && param <= 47) || (param >= 100 && param <= 107)) {
state.background = true;
return;
}
if (param === 58) {
state.underlineColor = true;
return;
}
if (param === 22) {
state.intensity = false;
return;
}
if (param === 23) {
state.italic = false;
return;
}
if (param === 24) {
state.underline = false;
return;
}
if (param === 25) {
state.blink = false;
return;
}
if (param === 27) {
state.inverse = false;
return;
}
if (param === 28) {
state.conceal = false;
return;
}
if (param === 29) {
state.strike = false;
return;
}
if (param === 39) {
state.foreground = false;
return;
}
if (param === 49) {
state.background = false;
return;
}
if (param === 55) {
state.overline = false;
return;
}
if (param === 59) {
state.underlineColor = false;
}
}
function emptySgrState() {
return {
intensity: false,
italic: false,
underline: false,
blink: false,
inverse: false,
conceal: false,
strike: false,
overline: false,
foreground: false,
background: false,
underlineColor: false,
};
}
function resetSgrState(state) {
state.intensity = false;
state.italic = false;
state.underline = false;
state.blink = false;
state.inverse = false;
state.conceal = false;
state.strike = false;
state.overline = false;
state.foreground = false;
state.background = false;
state.underlineColor = false;
}
function isSgrActive(state) {
return (state.intensity ||
state.italic ||
state.underline ||
state.blink ||
state.inverse ||
state.conceal ||
state.strike ||
state.overline ||
state.foreground ||
state.background ||
state.underlineColor);
}
{
"name": "@0disoft/laqu",
"version": "1.0.4",
"version": "1.0.5",
"description": "Reliable terminal progress and live CLI rendering primitives for TypeScript.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -53,2 +53,3 @@ # laqu

The API avoids ambiguous calls such as `update(42)`. Use `setCompleted(42)` for absolute progress and `advance(42)` for a delta.
Manual tasks also honor `TaskOptions.signal`; aborting the signal marks the task cancelled with the message `aborted`.

@@ -133,2 +134,3 @@ After `progress.close()` starts, the runtime stops accepting new tasks, logs, and task handle updates. Create a new runtime for later progress output.

"status": "running",
"depth": 0,
"progress": {

@@ -187,3 +189,3 @@ "kind": "ratio",

Do not mix child process output with live rendering through `stdio: "inherit"`. Pipe child output through the parent process and write it with `runtime.log()`, or close/pause the live renderer and run the child command in plain/log mode.
Do not mix child process output with live rendering through `stdio: "inherit"`. Pipe child output through the parent process and write it with `runtime.log()`, close the runtime before handing the terminal directly to the child process, or run progress output in plain/log mode.

@@ -205,7 +207,7 @@ ## Development

GitHub Actions publishes npm releases from maintainer-created version tags. The tag must match `package.json` exactly, for example `v1.0.4` for version `1.0.4`.
GitHub Actions publishes npm releases from maintainer-created version tags. The tag must match `package.json` exactly, for example `v1.0.5` for version `1.0.5`.
```sh
git tag -a v1.0.4 -m "v1.0.4"
git push origin main v1.0.4
git tag -a v1.0.5 -m "v1.0.5"
git push origin main v1.0.5
```

@@ -212,0 +214,0 @@