@vltpkg/cli-js 1.0.0-rc.11 → 1.0.0-rc.12
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/{bugs-QUSYBLWY.js → bugs-WQIWLUVW.js} +3 -3
- package/{build-WKF5EVJJ.js → build-GGH5MMW2.js} +2 -2
- package/{chunk-B3YANLCA.js → chunk-3SN5PW72.js} +4 -4
- package/{chunk-B3YANLCA.js.map → chunk-3SN5PW72.js.map} +2 -2
- package/{chunk-R3DCVMWU.js → chunk-5Y5FH5GW.js} +50 -11
- package/chunk-5Y5FH5GW.js.map +7 -0
- package/{chunk-3INOGDEC.js → chunk-GFW3IW7V.js} +2 -2
- package/{chunk-PRDIJ6RX.js → chunk-IRRQUZMX.js} +2 -2
- package/{chunk-G5DVO64E.js → chunk-IVJWC22L.js} +2 -2
- package/{chunk-EAQ7GUJL.js → chunk-LQOHFYR2.js} +2 -2
- package/{chunk-33BJIMPL.js → chunk-TOVIFC5G.js} +2 -2
- package/{chunk-EI37Y3D5.js → chunk-U6XIBBMI.js} +21 -21
- package/{ci-K3FB6Y6G.js → ci-DBO7FXYA.js} +2 -2
- package/cli-package.json +1 -1
- package/{docs-37QPQOHJ.js → docs-7V2FQGZZ.js} +3 -3
- package/{exec-VOQOMSQZ.js → exec-YTEQ537E.js} +5 -5
- package/{exec-cache-UJIOTIUA.js → exec-cache-VV527ORS.js} +3 -3
- package/{exec-local-VRIVYVKQ.js → exec-local-FNL4C4BI.js} +4 -4
- package/{help-AOPTYVTN.js → help-JRWFHTVV.js} +2 -2
- package/{install-CVVCRNX2.js → install-22MMBNQ6.js} +3 -3
- package/{list-R6MN3CMC.js → list-LGBQS6H2.js} +4 -4
- package/{pack-M2VSSNEE.js → pack-CXBWU4LR.js} +3 -3
- package/package.json +1 -1
- package/{pkg-S746UETL.js → pkg-BHBDVVCN.js} +3 -3
- package/{publish-TMPC2U53.js → publish-4UXZMYNN.js} +3 -3
- package/{query-5KTGYC75.js → query-GG5C7WXM.js} +4 -4
- package/registry-client-package.json +1 -1
- package/{run-5EPMVQTN.js → run-7BFRLGCU.js} +4 -4
- package/{run-exec-6FC3YUIA.js → run-exec-LUWPOAIB.js} +4 -4
- package/{serve-4J22YKX7.js → serve-RKIO2G6M.js} +6 -6
- package/{src-JYKLXMIE.js → src-YKXL5M6Q.js} +2 -2
- package/{uninstall-WLEAR7UD.js → uninstall-6WDI34DI.js} +3 -3
- package/{update-3JSBYJZ4.js → update-WT7I7RIW.js} +2 -2
- package/{version-IURCEFTL.js → version-QENW6HNS.js} +3 -3
- package/vlr.js +1 -1
- package/vlrx.js +1 -1
- package/vlt.js +1 -1
- package/vlx.js +1 -1
- package/vlxl.js +1 -1
- package/chunk-R3DCVMWU.js.map +0 -7
- /package/{bugs-QUSYBLWY.js.map → bugs-WQIWLUVW.js.map} +0 -0
- /package/{build-WKF5EVJJ.js.map → build-GGH5MMW2.js.map} +0 -0
- /package/{chunk-3INOGDEC.js.map → chunk-GFW3IW7V.js.map} +0 -0
- /package/{chunk-PRDIJ6RX.js.map → chunk-IRRQUZMX.js.map} +0 -0
- /package/{chunk-G5DVO64E.js.map → chunk-IVJWC22L.js.map} +0 -0
- /package/{chunk-EAQ7GUJL.js.map → chunk-LQOHFYR2.js.map} +0 -0
- /package/{chunk-33BJIMPL.js.map → chunk-TOVIFC5G.js.map} +0 -0
- /package/{chunk-EI37Y3D5.js.map → chunk-U6XIBBMI.js.map} +0 -0
- /package/{ci-K3FB6Y6G.js.map → ci-DBO7FXYA.js.map} +0 -0
- /package/{docs-37QPQOHJ.js.map → docs-7V2FQGZZ.js.map} +0 -0
- /package/{exec-VOQOMSQZ.js.map → exec-YTEQ537E.js.map} +0 -0
- /package/{exec-cache-UJIOTIUA.js.map → exec-cache-VV527ORS.js.map} +0 -0
- /package/{exec-local-VRIVYVKQ.js.map → exec-local-FNL4C4BI.js.map} +0 -0
- /package/{help-AOPTYVTN.js.map → help-JRWFHTVV.js.map} +0 -0
- /package/{install-CVVCRNX2.js.map → install-22MMBNQ6.js.map} +0 -0
- /package/{list-R6MN3CMC.js.map → list-LGBQS6H2.js.map} +0 -0
- /package/{pack-M2VSSNEE.js.map → pack-CXBWU4LR.js.map} +0 -0
- /package/{pkg-S746UETL.js.map → pkg-BHBDVVCN.js.map} +0 -0
- /package/{publish-TMPC2U53.js.map → publish-4UXZMYNN.js.map} +0 -0
- /package/{query-5KTGYC75.js.map → query-GG5C7WXM.js.map} +0 -0
- /package/{run-5EPMVQTN.js.map → run-7BFRLGCU.js.map} +0 -0
- /package/{run-exec-6FC3YUIA.js.map → run-exec-LUWPOAIB.js.map} +0 -0
- /package/{serve-4J22YKX7.js.map → serve-RKIO2G6M.js.map} +0 -0
- /package/{src-JYKLXMIE.js.map → src-YKXL5M6Q.js.map} +0 -0
- /package/{uninstall-WLEAR7UD.js.map → uninstall-6WDI34DI.js.map} +0 -0
- /package/{update-3JSBYJZ4.js.map → update-WT7I7RIW.js.map} +0 -0
- /package/{version-IURCEFTL.js.map → version-QENW6HNS.js.map} +0 -0
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
} from "./chunk-KUJV76HM.js";
|
|
15
15
|
import {
|
|
16
16
|
createHostContextsMap
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GFW3IW7V.js";
|
|
18
18
|
import "./chunk-IN6BBUSG.js";
|
|
19
19
|
import {
|
|
20
20
|
Query,
|
|
21
21
|
SecurityArchive,
|
|
22
22
|
actual
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5Y5FH5GW.js";
|
|
24
24
|
import "./chunk-6F6VOBW3.js";
|
|
25
25
|
import "./chunk-QEOLSUUZ.js";
|
|
26
26
|
import {
|
|
@@ -199,4 +199,4 @@ export {
|
|
|
199
199
|
usage,
|
|
200
200
|
views
|
|
201
201
|
};
|
|
202
|
-
//# sourceMappingURL=bugs-
|
|
202
|
+
//# sourceMappingURL=bugs-WQIWLUVW.js.map
|
|
@@ -11,7 +11,7 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
build
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5Y5FH5GW.js";
|
|
15
15
|
import "./chunk-6F6VOBW3.js";
|
|
16
16
|
import {
|
|
17
17
|
commandUsage
|
|
@@ -127,4 +127,4 @@ export {
|
|
|
127
127
|
usage,
|
|
128
128
|
views
|
|
129
129
|
};
|
|
130
|
-
//# sourceMappingURL=build-
|
|
130
|
+
//# sourceMappingURL=build-GGH5MMW2.js.map
|
|
@@ -19,12 +19,12 @@ import {
|
|
|
19
19
|
} from "./chunk-PXEDENDA.js";
|
|
20
20
|
import {
|
|
21
21
|
createHostContextsMap
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-GFW3IW7V.js";
|
|
23
23
|
import {
|
|
24
24
|
Query,
|
|
25
25
|
actual,
|
|
26
26
|
isRunResult
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5Y5FH5GW.js";
|
|
28
28
|
import {
|
|
29
29
|
Monorepo
|
|
30
30
|
} from "./chunk-CGWKWA24.js";
|
|
@@ -1179,7 +1179,7 @@ var ExecCommand = class {
|
|
|
1179
1179
|
assert(first, error("no nodes found"));
|
|
1180
1180
|
return resolve(this.projectRoot, first);
|
|
1181
1181
|
}
|
|
1182
|
-
return this.#monorepo?.values().next().value?.fullpath ??
|
|
1182
|
+
return this.#monorepo?.values().next().value?.fullpath ?? process.cwd();
|
|
1183
1183
|
}
|
|
1184
1184
|
fgArg() {
|
|
1185
1185
|
const cwd = this.getCwd();
|
|
@@ -1247,4 +1247,4 @@ export {
|
|
|
1247
1247
|
views,
|
|
1248
1248
|
ExecCommand
|
|
1249
1249
|
};
|
|
1250
|
-
//# sourceMappingURL=chunk-
|
|
1250
|
+
//# sourceMappingURL=chunk-3SN5PW72.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/fix-emoji.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/default-colors.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/hex-to-rgb.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/rgb-to-hex.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/dim-color.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/html-escape.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/named.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/xterm.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/style.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/block.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/terminal.ts", "../../../node_modules/.pnpm/ansi-to-pre@1.0.6/node_modules/ansi-to-pre/src/index.ts", "../../../src/cli-sdk/src/exec-command.ts"],
|
|
4
|
-
"sourcesContent": ["// Handling emoji is hard.\n// because many/most emoji are 2-character width, give or take,\n// but have bizarre line-height and spacing in most fonts, replace emojis\n// in the html string with an absolute-position wrapper and 2 spaces for\n// them to float above.\n// *Some* emojis are 1 character wide, so this ends up being a bit wrong\n// sometimes, but better too much space than have things be cut off or\n// overlapping, which looks broken.\n// Due to limitations of the emoji-regex, some complex emojis will render\n// as their constituent parts rather than the conjoined glyph.\n\nimport emojiRegex from 'emoji-regex'\nconst EMOJI_RE = emojiRegex()\nconst replaceWide = (c: string) => replaceNarrow(c) + ' '\nconst replaceNarrow = (c: string) =>\n `<span style=\"position:absolute;line-height:1;margin-top:0.3ex\">${c}</span> `\nexport const fixEmoji = (s: string): string => {\n return s\n .replace(/[\\u2500-\\u25FF]/g, replaceNarrow)\n .replace(EMOJI_RE, replaceWide)\n}\n", "let COLOR = '#eeeeee'\nlet BACKGROUND = '#222222'\n\nexport const defaultColor = (s?: string) => {\n if (s) COLOR = s\n return COLOR\n}\n\nexport const defaultBackground = (s?: string) => {\n if (s) BACKGROUND = s\n return BACKGROUND\n}\n", "export const hexToRgb = (c: string): [number, number, number] => {\n c = c.replace(/^#/, '')\n if (c.length === 3) {\n const r = c.charAt(0)\n const g = c.charAt(1)\n const b = c.charAt(2)\n return hexToRgb(`${r}${r}${g}${g}${b}${b}`)\n }\n if (c.length !== 6) {\n throw new Error('invalid hex string: ' + c)\n }\n const r = parseInt(c.substring(0, 2), 16)\n const g = parseInt(c.substring(2, 4), 16)\n const b = parseInt(c.substring(4, 6), 16)\n if (r !== r || g !== g || b !== b) {\n throw new Error('invalid hex string: ' + c)\n }\n return [r, g, b]\n}\n", "export const rgbToHex = ([r, g, b]: [number, number, number]): string => {\n if (r !== r || g !== g || b !== b) {\n throw new Error('invalid RGB: ' + [r, g, b].join(','))\n }\n return `#${\n Math.max(0, Math.min(r, 255)).toString(16).padStart(2, '0') +\n Math.max(0, Math.min(g, 255)).toString(16).padStart(2, '0') +\n Math.max(0, Math.min(b, 255)).toString(16).padStart(2, '0')\n }`\n}\n", "import { hexToRgb } from './hex-to-rgb.js'\nimport { rgbToHex } from './rgb-to-hex.js'\n\nconst DIMLEVEL = 0.75\nexport const dimColor = (c: string): string =>\n rgbToHex(\n hexToRgb(c).map(c => Math.floor(c * DIMLEVEL)) as [\n number,\n number,\n number,\n ],\n )\n", "export const htmlEscape = (s: string): string =>\n s\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n", "export type Names =\n | 'black'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'magenta'\n | 'cyan'\n | 'white'\n\nexport type NameCodes = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7\n\nexport const nameCodes: { [name in Names]: NameCodes } = {\n black: 0b000,\n red: 0b001,\n green: 0b010,\n yellow: 0b011,\n blue: 0b100,\n magenta: 0b101,\n cyan: 0b110,\n white: 0b111,\n}\n\nexport const codeNames: ReadonlyArray<Names> = [\n 'black',\n 'red',\n 'green',\n 'yellow',\n 'blue',\n 'magenta',\n 'cyan',\n 'white',\n] as const\n\nexport const namedColors: Omit<string[], number> & {\n 0: string\n 1: string\n 2: string\n 3: string\n 4: string\n 5: string\n 6: string\n 7: string\n} = [\n '#000000',\n '#ff0000',\n '#00a000',\n '#e0e000',\n '#0040e0',\n '#e000e0',\n '#00b0b0',\n '#e0e0e0',\n]\n\nexport const namedBrightColors: Omit<string[], number> & {\n 0: string\n 1: string\n 2: string\n 3: string\n 4: string\n 5: string\n 6: string\n 7: string\n} = [\n '#404040',\n '#ff3030',\n '#00ff00',\n '#ffff00',\n '#0080ff',\n '#ff33ff',\n '#00ffff',\n '#ffffff',\n]\n", "import { NameCodes, namedBrightColors, namedColors } from './named.js'\n\nconst hex = (n: number) => n.toString(16).padStart(2, '0')\n\nconst colors = [\n ...(function* () {\n for (let red = 0; red < 6; red++) {\n for (let green = 0; green < 6; green++) {\n for (let blue = 0; blue < 6; blue++) {\n const r = red ? red * 40 + 55 : 0\n const g = green ? green * 40 + 55 : 0\n const b = blue ? blue * 40 + 55 : 0\n yield `#${hex(r)}${hex(g)}${hex(b)}`\n }\n }\n }\n })(),\n]\n\nconst grays = [\n ...(function* () {\n for (let gray = 0; gray < 24; gray++) {\n const g = gray * 10 + 8\n yield `#${hex(g).repeat(3)}`\n }\n })(),\n]\n\nexport const xtermCode = (n: number) => {\n if (n < 8) return namedColors[n as NameCodes]\n if (n < 16) return namedBrightColors[(n - 8) as NameCodes]\n if (n < Math.pow(6, 3)) return colors[n - 16] as string\n if (n < 256) return grays[n - 232] as string\n}\n", "// this object is deposited into the style buffer in the Terminal\n// every time a character is written to the character buffer.\n// Handles all parsing of \\x1b[...m ANSI codes and conversion to CSS.\nimport { defaultBackground, defaultColor } from './default-colors.js'\nimport { dimColor } from './dim-color.js'\nimport { hexToRgb } from './hex-to-rgb.js'\nimport { htmlEscape } from './html-escape.js'\nimport {\n NameCodes,\n nameCodes,\n namedBrightColors,\n namedColors,\n Names,\n} from './named.js'\nimport { rgbToHex } from './rgb-to-hex.js'\nimport { xtermCode } from './xterm.js'\n\nconst ALL_END = '0'\nconst BG_END = '49'\nconst BG_START = '48'\nconst BOLD_END = '22'\nconst BOLD_START = '1'\nconst DIM_START = '2'\n// DIM_END is the same as BOLD_END because it's really \"font-weight:normal\"\n// In practice, dim modifies color, not font-weight, since modern screens\n// have colors, and most terminal fonts don't distinguish font weights other\n// than normal and bold.\nconst FG_END = '39'\nconst FG_START = '38'\nconst INV_END = '27'\nconst INV_START = '7'\nconst ITALIC_END = '23'\nconst ITALIC_START = '3'\nconst OVER_END = '55'\nconst OVER_START = '53'\nconst STRIKE_END = '29'\nconst STRIKE_START = '9'\nconst UNDERLINE_END = '24'\nconst UNDERLINE_START = '4'\nconst UNDERLINE_START_2 = '21' // WHYYYYYY\n\nconst NAMED_RE = /^(3|4|9|10)([0-7])$/\nconst NAMED_FG = '3'\nconst NAMED_BG = '4'\nconst NAMED_FG_BRIGHT = '9'\nconst NAMED_BG_BRIGHT = '10'\n\n// verifies that the style code is something that a Style object can handle,\n// and captures the first code and its parameter.\n// first code: $1\n// href: $2\n// styles: $3\nconst VALID_CODE = () =>\n new RegExp(\n '\\x1b\\\\]8;;' + // OSC hyperlink\n '(.*?)' + // href\n '(?:\\x1b|\\x07)' + // ST\n '|' +\n '\\x1b\\\\[' + // style codes\n '([0-9]*(?:;[0-9]*)*)' + // code numbers\n 'm', // end style codes\n 'g',\n )\n\ntype ParsedValidCode =\n | null\n | (RegExpExecArray &\n ([string, string, undefined] | [string, undefined, string]))\n\n/**\n * The properties that can be set on Style objects\n */\nexport type StyleProps = {\n /** may be either a hex string, or a named color */\n background?: string\n bold?: boolean\n /** may be either a hex string, or a named color */\n color?: string\n dim?: boolean\n inverse?: boolean\n italic?: boolean\n overline?: boolean\n strike?: boolean\n underline?: boolean\n /** hyperlink target, must be a valid url or `''` */\n href?: string\n}\n\nconst RESET_STYLE: StyleProps = {\n background: '',\n bold: false,\n color: '',\n dim: false,\n inverse: false,\n italic: false,\n overline: false,\n strike: false,\n underline: false,\n}\nconst RESET_PROPS: StyleProps = {\n ...RESET_STYLE,\n href: '',\n}\n\nconst namedColor = (c: string, bright = false): string => {\n if (!c) return c\n c = c.toLowerCase()\n const code = nameCodes[c as Names]\n if (typeof code === 'number') {\n return (bright ? namedBrightColors[code] : namedColors[code]) as string\n }\n if (c.includes('bright') && !bright) {\n return namedColor(c.replace(/bright/g, ''), true)\n }\n return rgbToHex(hexToRgb(c))\n}\n\nconst SEEN = new Map<string, Style>()\n\n/**\n * An immutable representation of an ANSI style. Used by Terminal and Block\n * to represent the styles in use for text to be printed.\n * If a Style object is created with the same properties as a\n * formerly seen Style object, the same object will be returned.\n *\n * For example:\n *\n * ```js\n * const a = new Style({ bold: true })\n * const b = new Style({ bold: true })\n * assert.equal(a, b) // passes\n * ```\n *\n * This optimization cuts down considerably on object creation,\n * because a Style is created for each styled character written to\n * the Terminal buffer. It also means that Style objects can be\n * compared directly with `===` to test for equivalence.\n */\nexport class Style {\n #css?: string\n\n #background!: string\n #bold!: boolean\n #color!: string\n #dim!: boolean\n #inverse!: boolean\n #italic!: boolean\n #overline!: boolean\n #strike!: boolean\n #underline!: boolean\n #ansi!: string\n #href!: string\n\n constructor(styles: StyleProps | string) {\n const {\n background = '',\n bold = false,\n color = '',\n dim = false,\n inverse = false,\n italic = false,\n overline = false,\n strike = false,\n underline = false,\n href = '',\n } = typeof styles !== 'string' ? styles : Style.ansiProperties(styles)\n\n const ansi = Style.propertiesAnsi({\n background,\n bold,\n color,\n dim,\n inverse,\n italic,\n overline,\n strike,\n underline,\n href,\n })\n\n // same style = same object\n const seen = SEEN.get(ansi)\n if (seen) return seen\n SEEN.set(ansi, this)\n\n this.#ansi = ansi\n this.#background = namedColor(background)\n this.#bold = bold\n this.#color = namedColor(color)\n this.#dim = dim\n this.#inverse = inverse\n this.#italic = italic\n this.#overline = overline\n this.#strike = strike\n this.#underline = underline\n try {\n this.#href = href && String(new URL(href))\n } catch {\n this.#href = ''\n }\n }\n\n /**\n * True if this style is a full reset of all properties.\n */\n get isReset() {\n return this === RESET\n }\n\n /** corresponding ANSI code sequence for this style */\n get ansi() {\n return this.#ansi\n }\n\n /** Convert a set of properties to an ANSI style code */\n static propertiesAnsi(styles: StyleProps): string {\n const {\n background,\n bold,\n color,\n dim,\n inverse,\n italic,\n overline,\n strike,\n underline,\n href = '',\n } = styles\n const codes = [\n // always do a reset at the start\n 0,\n ...(color ? [FG_START, 2, ...hexToRgb(namedColor(color))] : []),\n ...(background ?\n [BG_START, 2, ...hexToRgb(namedColor(background))]\n : []),\n ...(bold ? [BOLD_START] : []),\n ...(dim ? [DIM_START] : []),\n ...(inverse ? [INV_START] : []),\n ...(italic ? [ITALIC_START] : []),\n ...(overline ? [OVER_START] : []),\n ...(strike ? [STRIKE_START] : []),\n ...(underline ? [UNDERLINE_START] : []),\n ]\n return `\\x1b]8;;${href}\\x1b\\\\\\x1b[${codes.join(';')}m`\n }\n\n /**\n * If the input string is a sequence of *only* ANSI style and\n * OSC href codes, returns the array of codes and their parameters.\n * Otherwise, returns false.\n */\n static validStyleCodes(s: string): null | [string, string][] {\n let c = 0\n let m: ParsedValidCode\n const results: [string, string][] = []\n const vc = VALID_CODE()\n while ((m = vc.exec(s) as ParsedValidCode)) {\n if (c !== m.index) {\n return null\n }\n c += m[0].length\n results.push([m[0], m[1] ?? m[2]])\n }\n return results.length === 0 ? null : results\n }\n\n /** a Style object that resets all properties */\n static get RESET() {\n return RESET\n }\n\n /** Convert an ANSI style code to a set of properties */\n static ansiProperties(code: string): StyleProps {\n const codes = Style.validStyleCodes(code)\n if (!codes) {\n throw new Error('invalid ansi style code: ' + JSON.stringify(code))\n }\n const style: StyleProps = {}\n for (const code of codes) {\n if (code[0].startsWith('\\x1b]8;;')) {\n style.href = code[1]\n continue\n }\n const codes = code[1].split(';')\n for (let i = 0; i < codes.length; i++) {\n const c = codes[i] as string\n switch (c) {\n case '':\n case ALL_END:\n Object.assign(style, RESET_STYLE)\n continue\n case BOLD_END:\n style.bold = false\n style.dim = false\n continue\n case ITALIC_END:\n style.italic = false\n continue\n case STRIKE_END:\n style.strike = false\n continue\n case OVER_END:\n style.overline = false\n continue\n case UNDERLINE_END:\n style.underline = false\n continue\n case INV_END:\n style.inverse = false\n continue\n case FG_END:\n style.color = ''\n continue\n case BG_END:\n style.background = ''\n continue\n case BOLD_START:\n style.bold = true\n continue\n case INV_START:\n style.inverse = true\n continue\n case UNDERLINE_START:\n case UNDERLINE_START_2:\n style.underline = true\n continue\n case DIM_START:\n style.dim = true\n continue\n case OVER_START:\n style.overline = true\n continue\n case ITALIC_START:\n style.italic = true\n continue\n case STRIKE_START:\n style.strike = true\n continue\n case BG_START:\n case FG_START: {\n // 2 for rgb, 5 for xterm\n const next = codes[i + 1]\n const prop = c == FG_START ? 'color' : 'background'\n switch (next) {\n case '5':\n const xt = codes[i + 2]\n const code = xt && xtermCode(parseInt(xt, 10))\n if (code) {\n i += 2\n style[prop] = code\n }\n continue\n case '2':\n const sr = codes[i + 2]\n const sg = codes[i + 3]\n const sb = codes[i + 4]\n if (sr && sg && sb) {\n const r = parseInt(sr, 10)\n const g = parseInt(sg, 10)\n const b = parseInt(sb, 10)\n const hex = rgbToHex([r, g, b])\n if (\n r <= 255 &&\n r >= 0 &&\n g <= 255 &&\n g >= 0 &&\n b <= 255 &&\n b >= 0\n ) {\n i += 4\n style[prop] = hex\n }\n }\n }\n continue\n }\n // named color/bg\n default: {\n const m = c.match(NAMED_RE) as\n | null\n | (RegExpMatchArray & [string, string, string])\n if (!m) continue\n const color = parseInt(m[2], 10) as NameCodes\n switch (m[1]) {\n case NAMED_FG:\n style.color = namedColors[color]\n continue\n case NAMED_BG:\n style.background = namedColors[color]\n continue\n case NAMED_FG_BRIGHT:\n style.color = namedBrightColors[color]\n continue\n case NAMED_BG_BRIGHT:\n style.background = namedBrightColors[color]\n continue\n }\n }\n }\n }\n }\n return style\n }\n\n /**\n * Return a new Style with this one plus the updated properties.\n *\n * If a string is provided, must be a valid set of style and OSC hyperlink\n * ANSI code, though unrecognized parameters within that code will be ignored\n * rather than throwing an error.\n */\n update(properties: StyleProps | string): Style {\n const {\n background = this.#background,\n bold = this.#bold,\n color = this.#color,\n dim = this.#dim,\n inverse = this.#inverse,\n italic = this.#italic,\n overline = this.#overline,\n strike = this.#strike,\n underline = this.#underline,\n href = this.#href,\n } =\n typeof properties === 'string' ?\n Style.ansiProperties(properties)\n : properties\n\n return (\n background === this.#background &&\n bold === this.#bold &&\n color === this.#color &&\n dim === this.#dim &&\n inverse === this.#inverse &&\n italic === this.#italic &&\n overline === this.#overline &&\n strike === this.#strike &&\n underline === this.#underline &&\n href === this.#href\n ) ?\n this\n : new Style({\n background,\n bold,\n color,\n dim,\n inverse,\n italic,\n overline,\n strike,\n underline,\n href,\n })\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](\n _: any,\n { colors }: { colors: boolean } = { colors: false },\n ) {\n const { ansi } = this\n return `Style { ${colors ? ansi : ''}${ansi.replace(/\\x1b/g, '^[')}${\n colors ? '\\x1b]8;;\\x1b\\\\\\x1b[m' : ''\n } }`\n }\n\n /**\n * Wrap the input string in the appropriate HTML for this style\n */\n wrap(s: string) {\n const css = this.toString()\n const href = this.#href\n if (!css && !href) return htmlEscape(s)\n const tag = href ? `a` : 'span'\n return `<${tag}${href ? ` href=\"${href}\"` : ''}${\n css ? ` style=\"${css}\"` : ''\n }>${htmlEscape(s)}</${tag}>`\n }\n\n /**\n * Return just the CSS for the styles. Href is not relevant.\n */\n toString() {\n if (this.#css) return this.#css\n let color = this.#inverse ? this.#background : this.#color\n let background = this.#inverse ? this.#color : this.#background\n if (this.#inverse) {\n color ||= defaultBackground()\n background ||= defaultColor()\n }\n // dim text is a different color, unless the background is the same\n // color, and set to something other than default. !?!? hwyyyyyyy idgi\n if (this.#dim && !(color && color === background)) {\n color = dimColor(color || defaultColor())\n }\n const textDecoration = [\n ...(this.#underline ? ['underline'] : []),\n ...(this.#overline ? ['overline'] : []),\n ...(this.#strike ? ['line-through'] : []),\n ].join(' ')\n\n return (this.#css = [\n ...(textDecoration ? [`text-decoration:${textDecoration}`] : []),\n ...(this.#bold ? ['font-weight:bold']\n : this.#dim ? ['font-weight:100']\n : []),\n ...(this.#italic ? ['font-style:italic'] : []),\n ...(color ? [`color:${color}`] : []),\n ...(background ? [`background:${background}`] : []),\n ].join(';'))\n }\n}\n\nconst RESET = new Style(RESET_PROPS)\n", "import { InspectOptions } from 'util'\nimport { fixEmoji } from './fix-emoji.js'\nimport { Style } from './style.js'\n\n/**\n * A representation of a run of text in a given style\n */\nexport class Block {\n #style?: Style\n #text: string\n\n constructor(text: string, style?: Style) {\n this.#text = text\n this.#style = style\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](\n _: any,\n opts: InspectOptions,\n inspect: typeof import('util').inspect,\n ) {\n return `Block {${\n this.#style ? ' ' + inspect(this.#style, opts) : ''\n } ${inspect(this.#text, opts)} }`\n }\n\n /** return the block as a styled `<span>` tag */\n toString() {\n return this.#toString(false)\n }\n\n /** a representation of the block as an ANSI styled string */\n get ansi() {\n return this.#toString(true)\n }\n\n #toString(ansi: boolean) {\n return (\n !this.#text ? ''\n : ansi ? (this.#style ?? Style.RESET).ansi + this.#text\n : fixEmoji((this.#style ?? Style.RESET).wrap(this.#text))\n )\n }\n\n /** append text to the block */\n write(c: string) {\n this.#text += c\n return this\n }\n\n /** the raw text that will be written */\n get text() {\n return this.#text\n }\n\n /** the Style used by this block */\n get style() {\n return this.#style\n }\n}\n", "import { InspectOptions } from 'util'\nimport { Block } from './block.js'\nimport { defaultBackground, defaultColor } from './default-colors.js'\nimport { Style, StyleProps } from './style.js'\nconst CODES_RE =\n /^\\u001b\\[([0-9]*[A-GJKSTg]|([0-9;]*)m|([0-9]*;?[0-9]*)?[Hf]|\\?[0-9]+[hl])/\n\nconst OSC_RE = /^\\u001b\\](.*?)(?:\\u0007|\\u001b\\\\)/\nconst OSC_TITLE = '0;'\nconst OSC_HREF = '8;;'\n\n/**\n * A representation of a virtual \"terminal\" where we write out the character\n * and style information as we parse through the ANSI encoded stream.\n *\n * Important: this is *not* a full-fledged Stream class. You can write to it\n * multiple times, and it will update appropriately, but it does zero buffering\n * or input validation, so writing a partial ANSI code sequence will result in\n * mochibake in the output.\n *\n * The virtual terminal is an infinitely high and wide screen, with no\n * scrollback buffer. So, when `scrollDown(n)` is called (either explicitly, or\n * with a `\\x1b[<n>S` ANSI code), `n` lines are removed from the top of the\n * \"screen\". When `scrollUp(n)` is called (explicitly or via a `\\x1b[<n>T` ANSI\n * code), `n` _empty_ lines are added to the top of the screen; the lines lost\n * to a previous `scrollDown` action are not restored when scrolling up.\n *\n * Also, actions that move the cursor down or to the right, which would on a\n * normal physical terminal be limited to the height/width of the terminal, are\n * unbounded. For example, on an actual terminal, `echo $'\\x1b[1000Bhello'`\n * will print \"hello\" at the bottom of the screen (unless your screen happens\n * to be more than 1000 lines high); in this virtual terminal, it will create\n * 1000 empty lines.\n *\n * Most of the methods (other than `toString()` of course) return `this`,\n * allowing for things like this:\n *\n * ```js\n * console.log(\n * new Terminal()\n * .setStyle({ color: '#ff0000' })\n * .write('hello, ')\n * .down(1)\n * .setStyle({ inverse: true })\n * .write('world!').ansi\n * )\n * ```\n */\nexport class Terminal {\n // note: 0-indexed, but all the ansi codes are 1-indexed\n #cursor: [number, number] = [0, 0]\n // character data\n #text: string[][] = []\n // the style used to write it\n #style: (Style | undefined)[][] = []\n // the current style we use to paint characters to our \"screen\"\n #brush: Style = new Style({})\n\n #title: string = ''\n #blocks?: Block[]\n\n constructor(input?: string) {\n if (input) this.write(input)\n }\n\n /**\n * Set the style that the terminal will use for text writes.\n *\n * If a string, must be a valid `\\x1b[...m` ANSI style code.\n *\n * The styles provided will be appended onto the current style in use, just\n * as they would be by a real terminal if the relevant ANSI code is\n * encountered.\n */\n setStyle(style: string | StyleProps): Terminal {\n this.#brush = this.#brush.update(style)\n return this\n }\n\n /** Move the cursor up `n` lines, stopping at the top. */\n up(n: number): Terminal {\n this.#cursor[0] = Math.max(this.#cursor[0] - n, 0)\n return this\n }\n\n /** Move the cursor down `n` lines, without limit. */\n down(n: number): Terminal {\n // move down\n // in real life, this would be maxed to the size of the screen buffer,\n // but since this virtual terminal is an infinitely high and wide screen,\n // we just let it create new lines.\n this.#cursor[0] += n\n return this\n }\n\n /**\n * Prepend `n` empty lines at the start of the buffer, effectively moving the\n * cursor up as a result.\n */\n scrollUp(n: number): Terminal {\n // add n lines at the start of the buffer\n // leaves the cursor at the same index it was at before, effectively\n // moving it up as a result.\n for (let i = 0; i < n; i++) {\n this.#text.unshift([])\n this.#style.unshift([])\n }\n return this\n }\n\n /**\n * Remove `n` lines from the start of the buffer, effectively moving the\n * cursor down as a result.\n */\n scrollDown(n: number): Terminal {\n // remove lines from the top of the buffer, effectively moving\n // the cursor down as a result.\n // TODO: Maybe it would be good to keep a scrollback buffer,\n // and move lines into/out of there on scroll?\n for (let i = 0; i < n; i++) {\n this.#text.shift()\n this.#style.shift()\n }\n return this\n }\n\n /** Move the cursor forward `n` columns, without limit. */\n forward(n: number): Terminal {\n this.#cursor[1] += n\n return this\n }\n\n /** Move the cursor back `n` columns, stopping at the first column. */\n back(n: number): Terminal {\n this.#cursor[1] = Math.max(0, this.#cursor[1] - n)\n return this\n }\n\n /** Move to the start of the `n`-th next line. */\n nextLine(n: number): Terminal {\n this.#cursor[0] += n\n this.#cursor[1] = 0\n return this\n }\n\n /**\n * Move to the start of the `n`-th previous line, stopping at the top of the\n * screen.\n */\n prevLine(n: number): Terminal {\n this.#cursor[0] = Math.max(0, this.#cursor[0] - n)\n this.#cursor[1] = 0\n return this\n }\n\n /**\n * Move to the `n`-th column (1-indexed), limited by the left-most column.\n */\n horizontalPosition(n: number): Terminal {\n this.#cursor[1] = Math.max(0, n - 1)\n return this\n }\n\n /**\n * Move to the 1-indexed row and column specified, limited by the top and\n * left sides of the screen.\n */\n position(row: number, col: number): Terminal {\n this.#cursor[0] = Math.max(row - 1, 0)\n this.#cursor[1] = Math.max(col - 1, 0)\n return this\n }\n\n /**\n * Delete all printed data from the screen.\n *\n * Note that this is used for both `\\x1b[2J` _and_ `\\x1b[3J`, because there\n * is no scrollback buffer in this virtual terminal.\n */\n eraseScreen(): Terminal {\n // erase entire screen\n this.#text.length = 0\n this.#style.length = 0\n return this\n }\n\n /** Delete all printed data from the cursor to the end of the screen. */\n eraseScreenToEnd(): Terminal {\n // erase from cursor to end of screen\n this.#text.splice(this.#cursor[0] + 1)\n this.#style.splice(this.#cursor[0] + 1)\n this.eraseLineToEnd()\n return this\n }\n\n /** Delete all printed data from the top of the screen to the cursor. */\n eraseScreenFromStart(): Terminal {\n // erase from beginning of screen to cursor\n let i\n for (i = 0; i < this.#cursor[0]; i++) {\n const line = this.#text[i]\n const sline = this.#style[i]\n /* c8 ignore start */\n if (!line || !sline) continue\n /* c8 ignore stop */\n line.length = 0\n sline.length = 0\n }\n this.eraseLineFromStart()\n return this\n }\n\n /** Delete the contents of the current line. */\n eraseLine(): Terminal {\n const line = this.#text[this.#cursor[0]]\n const sline = this.#style[this.#cursor[0]]\n if (!line || !sline) return this\n line.length = 0\n sline.length = 0\n return this\n }\n\n /**\n * Delete printed data from the cursor to the end of the current line.\n */\n eraseLineToEnd(): Terminal {\n const line = this.#text[this.#cursor[0]]\n const sline = this.#style[this.#cursor[0]]\n if (!line || !sline) return this\n // from cursor to end of line\n line.splice(this.#cursor[1])\n sline.splice(this.#cursor[1])\n return this\n }\n\n /**\n * Delete printed data from the start of the current line to the cursor.\n */\n eraseLineFromStart(): Terminal {\n if (this.#cursor[1] === 0) return this.eraseLine()\n /* c8 ignore start */\n const line = this.#text[this.#cursor[0]]\n const sline = this.#style[this.#cursor[0]]\n /* c8 ignore stop */\n if (!line || !sline) return this\n for (let i = 0; i < this.#cursor[1]; i++) {\n line[i] = ' '\n sline[i] = undefined\n }\n return this\n }\n\n /**\n * Parse the ANSI encoded string provided, updating the internal character\n * and style buffers appropriately.\n */\n write(input: string): Terminal {\n this.#blocks = undefined\n // remove title-setting sequences\n for (let c = 0; c < input.length; ) {\n while (input.charAt(c) === '\\x1b') {\n // codes that don't use the OSC or CSI code\n switch (input.charAt(c + 1)) {\n case 'B':\n this.horizontalPosition(1)\n c += 2\n continue\n case 'H':\n // tab stops, not supported, ignore\n c += 2\n continue\n case 'D':\n this.scrollDown(1)\n c += 2\n continue\n case 'M':\n this.scrollUp(1)\n c += 2\n continue\n }\n\n // cursor/screen motion/erase commands\n const code = input.substring(c).match(CODES_RE) as\n | null\n | (RegExpMatchArray & [string, string])\n if (code) {\n c += code[0].length\n if (code[1].endsWith('m')) {\n // style code\n this.setStyle(code[0])\n continue\n } else {\n const x = code[1].charAt(code[1].length - 1)\n if (x === 'H' || x === 'f') {\n // cursor position\n const [n, m] = code[1].replace(/[Hf]$/, '').split(';')\n const row = Math.max(1, parseInt(n || '1', 10))\n const col = Math.max(1, parseInt(m || '1', 10))\n this.position(row, col)\n continue\n }\n // these all have an optional 1-indexed parameter\n // that defaults to 1, except J and K which default to 0\n const p = code[1].match(/^([0-9]+)/)?.[1]\n const n = parseInt(p || '1', 10)\n const z = parseInt(p || '0', 10)\n switch (x) {\n case 'A':\n this.up(n)\n continue\n case 'T':\n this.scrollUp(n)\n continue\n case 'B':\n this.down(n)\n continue\n case 'S':\n this.scrollDown(n)\n continue\n case 'C':\n this.forward(n)\n continue\n case 'D':\n this.back(n)\n continue\n case 'E':\n this.nextLine(n)\n continue\n case 'F':\n this.prevLine(n)\n continue\n case 'G':\n this.horizontalPosition(n)\n continue\n case 'J': {\n switch (z) {\n case 0:\n this.eraseScreenToEnd()\n continue\n case 1:\n this.eraseScreenFromStart()\n continue\n case 2:\n case 3:\n this.eraseScreen()\n continue\n }\n continue\n }\n case 'K': {\n switch (z) {\n case 0:\n this.eraseLineToEnd()\n continue\n case 1:\n this.eraseLineFromStart()\n continue\n case 2:\n this.eraseLine()\n continue\n }\n continue\n }\n }\n }\n continue\n }\n\n // check for OSC (title and hyperlinks)\n const osc = input.substring(c).match(OSC_RE) as\n | null\n | (RegExpMatchArray & [string, string])\n if (osc?.index === 0) {\n c += osc[0].length\n const cmd = osc[1]\n if (cmd.startsWith(OSC_TITLE)) {\n this.setTitle(cmd.substring(OSC_TITLE.length))\n continue\n }\n if (cmd.startsWith(OSC_HREF)) {\n this.setStyle({ href: cmd.substring(OSC_HREF.length) })\n continue\n }\n continue\n }\n\n // some other code we don't support, treat as text\n break\n }\n\n // end parsing ansi codes, might have walked off the input\n if (c >= input.length) break\n\n const ch = input.charAt(c++)\n\n if (ch === '\\r') {\n this.horizontalPosition(1)\n continue\n }\n if (ch === '\\n') {\n this.nextLine(1)\n continue\n }\n\n // write a character\n // if we are off the painted terminal, paint up to that point\n while (this.#text.length < this.#cursor[0]) {\n this.#text.push([])\n this.#style.push([])\n }\n const sline = this.#style[this.#cursor[0]] || []\n const line = this.#text[this.#cursor[0]] || []\n while (line.length < this.#cursor[1]) {\n line.push(' ')\n }\n while (sline.length < this.#cursor[1]) {\n sline.push(undefined)\n }\n line[this.#cursor[1]] = ch\n sline[this.#cursor[1]] =\n this.#brush.isReset ? undefined : this.#brush\n this.#style[this.#cursor[0]] = sline\n this.#text[this.#cursor[0]] = line\n this.forward(1)\n }\n return this\n }\n\n /**\n * Called when an OSC code of `\\x1b]0;...\\x1b\\` is encountered.\n *\n * Sets the `title` attribute on the root `<pre>` in html output,\n * and creates a corresponding OSC title sequence in the ansi output.\n */\n setTitle(s: string) {\n this.#title = s\n return this\n }\n\n /** the raw unstyled text of each line */\n get text() {\n return this.#text.map(l => l.join(''))\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](\n _: any,\n opts: InspectOptions,\n inspect: typeof import('util').inspect,\n ) {\n const ins = inspect(\n {\n cursor: this.#cursor,\n brush: this.#brush,\n text: this.#text.map(l => l.join('')),\n blocks: this.blocks,\n },\n opts,\n )\n return `Terminal ${ins}`\n }\n\n /**\n * Output the results of the style and character buffers as ANSI\n * styled text. This effectively normalizes all color codes to explicit\n * RGB values and resolves all cursor motions and other control codes,\n * and styling runs of identical styles with a single code.\n */\n get ansi() {\n return this.#toString(true)\n }\n\n /**\n * Output the results of the style and character buffers as a `<pre>`\n * tag with `<span>` elements setting effective styles.\n */\n toString() {\n return this.#toString(false)\n }\n\n /**\n * An array of `Block` objects each representing a string of text with a\n * given style.\n */\n get blocks(): Block[] {\n if (this.#blocks) return this.#blocks\n let cur: Block = new Block('')\n const blocks: Block[] = [cur]\n for (let i = 0; i < this.#text.length; i++) {\n /* c8 ignore start */\n const line = this.#text[i] || []\n const sline = this.#style[i] || []\n /* c8 ignore stop */\n for (let j = 0; j < line.length; j++) {\n const st = sline[j]\n // will always be set\n /* c8 ignore start */\n const ch = line[j] || ''\n /* c8 ignore stop */\n if (st === cur.style) cur.write(ch)\n else blocks.push((cur = new Block(ch, st)))\n }\n // append a \\n only if we're not at the end\n if (this.#text[i + 1]) cur.write('\\n')\n }\n return (this.#blocks = blocks.filter(b => !!b.text))\n }\n\n #toString(ansi: boolean) {\n // turn into an array of [string, Style?], concatenating runs\n // of the same style into a single string.\n const contents = this.blocks\n .map(b => (ansi ? b.ansi : b.toString()))\n .join('')\n if (ansi) {\n const title = this.#title ? `\\x1b]0;${this.#title}\\x1b\\\\` : ''\n return title + contents + '\\x1b[m'\n }\n const css = Object.entries({\n color: defaultColor(),\n background: defaultBackground(),\n position: 'relative',\n })\n .map(kv => kv.join(':'))\n .join(';')\n const preStyle = `style=\"${css}\"`\n const preTitle = this.#title ? ` title=\"${this.#title}\"` : ''\n return `<pre ${preStyle}${preTitle}>${contents}</pre>`\n }\n}\n", "export * from './block.js'\nexport * from './default-colors.js'\nexport * from './named.js'\nexport * from './xterm.js'\nexport * from './style.js'\nexport * from './terminal.js'\nexport * from './theme.js'\nimport { Terminal } from './terminal.js'\n\n/**\n * Convert a string of ANSI text into an HTML `<pre>` tag.\n */\nexport const ansiToPre = (input: string) => String(new Terminal(input))\n\n/**\n * Convert a string of ANSI text into a string of ANSI text with normalized\n * RGB color codes and all cursor control sequences resolved.\n */\nexport const ansiToAnsi = (input: string) => new Terminal(input).ansi\n", "/**\n * impl for `vlt run`, `vlt run-exec`, `vlt exec-local`, `vlt exec`\n * @module\n */\n\nimport { error } from '@vltpkg/error-cause'\nimport { isErrorWithCause } from '@vltpkg/types'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type {\n exec,\n execFG,\n ExecOptions,\n run,\n runExec,\n runExecFG,\n RunExecOptions,\n runFG,\n RunFGResult,\n RunOptions,\n RunResult,\n} from '@vltpkg/run'\nimport { Query } from '@vltpkg/query'\nimport { actual } from '@vltpkg/graph'\nimport { isRunResult } from '@vltpkg/run'\nimport { Monorepo } from '@vltpkg/workspaces'\nimport { ansiToAnsi } from 'ansi-to-pre'\nimport type { LoadedConfig } from './config/index.ts'\nimport { stderr, stdout, styleTextStdout } from './output.ts'\nimport type { Views } from './view.ts'\nimport type { SpawnResultStdioStrings } from '@vltpkg/promise-spawn'\nimport assert from 'node:assert'\nimport { resolve } from 'node:path'\nimport { createHostContextsMap } from './query-host-contexts.ts'\n\nexport type RunnerBG = typeof exec | typeof run | typeof runExec\nexport type RunnerFG = typeof execFG | typeof runExecFG | typeof runFG\nexport type RunnerOptions = ExecOptions & RunExecOptions & RunOptions\nexport type MultiRunResult = Record<string, RunResult>\nexport type ScriptSet = Record<string, string>\nexport type MultiScriptSet = Record<string, ScriptSet>\nexport type ExecResult =\n | RunFGResult\n | MultiRunResult\n | ScriptSet\n | MultiScriptSet\n\nconst isScriptSet = (o: unknown): o is ScriptSet => {\n if (!o || typeof o !== 'object') return false\n for (const v of Object.values(o)) {\n if (typeof v !== 'string') return false\n }\n return true\n}\n\nconst isMultiScriptSet = (\n o: ExecResult,\n): o is Record<string, ScriptSet> => {\n for (const v of Object.values(o)) {\n if (!isScriptSet(v)) return false\n }\n return true\n}\n\nconst isSingleSuccess = (\n o: RunResult,\n): o is RunResult & { status: 0; signal: null } =>\n o.signal === null && o.status === 0\n\nconst setExitCode = (result: RunResult) => {\n /* c8 ignore next */\n process.exitCode ||= result.status ?? 1\n}\n\nexport const views = {\n // run results for single or multiple will be printed along the way.\n human: result => {\n if (isScriptSet(result)) stdout('Scripts available:', result)\n else if (isMultiScriptSet(result)) {\n stdout('Scripts available:')\n for (const [path, scripts] of Object.entries(result)) {\n stdout(path, scripts)\n }\n }\n },\n json: result =>\n isRunResult(result) && isSingleSuccess(result) ?\n undefined\n : result,\n} as const satisfies Views<ExecResult>\n\ntype ViewValues = 'human' | 'json' | 'inspect' | 'silent'\n\nexport class ExecCommand<B extends RunnerBG, F extends RunnerFG> {\n bg: B\n fg: F\n arg0?: string\n args: string[]\n env?: NodeJS.ProcessEnv\n #monorepo?: Monorepo\n #nodes?: string[]\n #defaultIgnoreMissing = false\n conf: LoadedConfig\n projectRoot: string\n view: ViewValues\n validViewValues = new Map<string, ViewValues>([\n ['human', 'human'],\n ['json', 'json'],\n ['inspect', 'inspect'],\n ['silent', 'silent'],\n ])\n\n constructor(conf: LoadedConfig, bg: B, fg: F) {\n this.conf = conf\n this.bg = bg\n this.fg = fg\n this.view = this.validViewValues.get(conf.values.view) ?? 'human'\n const {\n projectRoot,\n positionals: [arg0, ...args],\n } = conf\n this.arg0 = arg0\n this.args = args\n this.projectRoot = projectRoot\n }\n\n #targetCount(): number {\n if (this.#nodes) return this.#nodes.length\n return this.#monorepo?.size ?? 1\n }\n\n hasArg0(): this is this & { arg0: string } {\n return !!this.arg0\n }\n\n async run(): Promise<ExecResult> {\n const { conf } = this\n\n const queryString = conf.get('scope')\n const paths = conf.get('workspace')\n const groups = conf.get('workspace-group')\n const recursive = conf.get('recursive')\n\n // scope takes precedence over workspaces or groups\n if (queryString) {\n this.#defaultIgnoreMissing = true\n const mainManifest = conf.options.packageJson.maybeRead(\n this.projectRoot,\n )\n let graph\n if (mainManifest) {\n graph = actual.load({\n ...conf.options,\n mainManifest,\n monorepo: Monorepo.load(this.projectRoot),\n loadManifests: false,\n })\n }\n const hostContexts = await createHostContextsMap(conf)\n const query = new Query({\n /* c8 ignore start */\n nodes: graph ? new Set(graph.nodes.values()) : new Set(),\n edges: graph?.edges ?? new Set(),\n importers: graph?.importers ?? new Set(),\n /* c8 ignore stop */\n securityArchive: undefined,\n hostContexts,\n })\n const { nodes } = await query.search(queryString, {\n signal: new AbortController().signal,\n })\n this.#nodes = []\n for (const node of nodes) {\n const { location } = node.toJSON()\n assert(\n location,\n error(`node ${node.id} has no location`, {\n found: node,\n }),\n )\n this.#nodes.push(location)\n }\n } else if (paths?.length || groups?.length || recursive) {\n this.#defaultIgnoreMissing = true\n this.#monorepo = Monorepo.load(this.projectRoot, {\n load: { paths, groups },\n })\n }\n\n if (this.#targetCount() === 1) {\n const arg = this.fgArg()\n if (!arg) return this.noArgsSingle()\n const result = await this.fg(arg)\n if (isRunResult(result)) {\n setExitCode(result)\n }\n return result\n }\n\n if (this.#targetCount() === 0) {\n if (queryString) {\n throw error('no matching nodes found for query', {\n found: queryString,\n })\n } else {\n throw error('no matching workspaces found', {\n /* c8 ignore next - already guarded */\n validOptions: [...(this.#monorepo?.load().paths() ?? [])],\n })\n }\n }\n\n if (!this.hasArg0()) {\n return this.noArgsMulti()\n }\n\n // run across workspaces\n let failed = false as boolean\n const runInDir = async (cwd: string, label: string) => {\n const result = await this.bg(this.bgArg(cwd)).catch(\n (er: unknown) => {\n if (isErrorWithCause(er) && isRunResult(er.cause)) {\n this.printResult(label, er.cause)\n }\n failed = true\n throw er\n },\n )\n // If we are allowed to ignore missing commands, then command might be\n // an emptry string. If so, we don't print anything and return null to\n // be filtered out later.\n if (!result.command) return null\n if (!failed) this.printResult(label, result)\n return result\n }\n\n const resultMap = new Map<string, SpawnResultStdioStrings>()\n if (this.#nodes) {\n for (const { label, cwd } of this.getTargets()) {\n const result = await runInDir(cwd, label)\n if (result) resultMap.set(label, result)\n }\n } else if (this.#monorepo) {\n const wsResultMap = await this.#monorepo.run(ws =>\n runInDir(ws.fullpath, ws.path),\n )\n for (const [ws, result] of wsResultMap) {\n if (result) resultMap.set(ws.path, result)\n }\n }\n\n const results: Record<string, RunResult> = {}\n for (const [path, result] of resultMap) {\n if (result.status === 0 && result.signal === null) {\n result.stdout = ''\n result.stderr = ''\n }\n results[path] = result\n }\n return results\n }\n\n printResult(path: string, result: RunResult) {\n // non-human results just get printed at the end\n if (this.view !== 'human') return\n\n if (result.status === 0 && result.signal === null) {\n stdout(path, 'ok')\n } else {\n stdout(\n styleTextStdout(\n ['bgWhiteBright', 'black', 'bold'],\n path + ' failure',\n ),\n {\n status: result.status,\n signal: result.signal,\n },\n )\n /* c8 ignore start */\n if (result.stderr) stderr(ansiToAnsi(result.stderr))\n if (result.stdout) stdout(ansiToAnsi(result.stdout))\n /* c8 ignore stop */\n setExitCode(result)\n }\n }\n\n /* c8 ignore start - env specific */\n interactiveShell(): string {\n return (\n process.env.SHELL ??\n this.conf.get('script-shell') ??\n (process.platform === 'win32' ? 'cmd.exe' : '/bin/sh')\n )\n }\n /* c8 ignore stop */\n\n // overridden by 'vlt run' which returns undefined\n defaultArg0(): string | undefined {\n return this.interactiveShell()\n }\n\n getCwd(): string {\n if (this.#nodes) {\n const [first] = this.#nodes\n assert(first, error('no nodes found'))\n return resolve(this.projectRoot, first)\n }\n return (\n this.#monorepo?.values().next().value?.fullpath ??\n this.projectRoot\n )\n }\n\n fgArg(): RunnerOptions | undefined {\n const cwd = this.getCwd()\n const arg0 = this.arg0 ?? this.defaultArg0()\n\n // return undefined so noArgsSingle will be called instead\n if (typeof arg0 !== 'string') return\n\n return {\n cwd,\n arg0,\n args: this.args,\n env: this.env,\n projectRoot: this.projectRoot,\n packageJson: this.conf.options.packageJson,\n 'script-shell':\n this.arg0 ? this.conf.get('script-shell') : false,\n }\n }\n\n bgArg(this: this & { arg0: string }, cwd: string): RunnerOptions {\n return {\n cwd,\n acceptFail: !this.conf.get('bail'),\n ignoreMissing:\n this.conf.get('if-present') ?? this.#defaultIgnoreMissing,\n arg0: this.arg0,\n args: this.args,\n env: this.env,\n projectRoot: this.projectRoot,\n packageJson: this.conf.options.packageJson,\n 'script-shell': this.conf.get('script-shell'),\n }\n }\n\n /* c8 ignore start - not used, only here to override */\n noArgsSingle(): ScriptSet {\n throw error('Failed to determine interactive shell to spawn')\n }\n /* c8 ignore stop - not used, only here to override */\n\n noArgsMulti(): MultiScriptSet {\n throw error(\n 'Cannot spawn interactive shells in multiple workspaces',\n )\n }\n\n getTargets(): {\n label: string\n cwd: string\n manifest: NormalizedManifest\n }[] {\n const targets = []\n if (this.#nodes) {\n for (const location of this.#nodes) {\n const manifest = this.conf.options.packageJson.read(location)\n const label =\n /* c8 ignore next */\n location.startsWith('./') ? location.slice(2) : location\n const cwd = resolve(this.projectRoot, location)\n targets.push({ label, cwd, manifest })\n }\n } else if (this.#monorepo) {\n this.#monorepo.runSync(ws => {\n targets.push({\n label: ws.path,\n cwd: ws.fullpath,\n manifest: ws.manifest,\n })\n })\n }\n return targets\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,yBAAuB;AACvB,IAAM,eAAW,mBAAAA,SAAU;AAC3B,IAAM,cAAc,CAAC,MAAc,cAAc,CAAC,IAAI;AACtD,IAAM,gBAAgB,CAAC,MACrB,kEAAkE,CAAC;AAC9D,IAAM,WAAW,CAAC,MAAqB;AAC5C,SAAO,EACJ,QAAQ,oBAAoB,aAAa,EACzC,QAAQ,UAAU,WAAW;AAClC;;;ACpBA,IAAI,QAAQ;AACZ,IAAI,aAAa;AAEV,IAAM,eAA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;AAAA,MAC/B,gBAAgB,KAAK,KAAK,IAAI,cAAc;AAAA,IAC9C;AAAA,EACF;AAAA;AAAA,EAGA,eAA0B;AACxB,UAAM,MAAM,gDAAgD;AAAA,EAC9D;AAAA;AAAA,EAGA,cAA8B;AAC5B,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAAA,EAEA,aAII;AACF,UAAM,UAAU,CAAC;AACjB,QAAI,KAAK,QAAQ;AACf,iBAAW,YAAY,KAAK,QAAQ;AAClC,cAAM,WAAW,KAAK,KAAK,QAAQ,YAAY,KAAK,QAAQ;AAC5D,cAAM;AAAA;AAAA,UAEJ,SAAS,WAAW,IAAI,IAAI,SAAS,MAAM,CAAC,IAAI;AAAA;AAClD,cAAM,MAAM,QAAQ,KAAK,aAAa,QAAQ;AAC9C,gBAAQ,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC;AAAA,MACvC;AAAA,IACF,WAAW,KAAK,WAAW;AACzB,WAAK,UAAU,QAAQ,QAAM;AAC3B,gBAAQ,KAAK;AAAA,UACX,OAAO,GAAG;AAAA,UACV,KAAK,GAAG;AAAA,UACR,UAAU,GAAG;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;",
|
|
4
|
+
"sourcesContent": ["// Handling emoji is hard.\n// because many/most emoji are 2-character width, give or take,\n// but have bizarre line-height and spacing in most fonts, replace emojis\n// in the html string with an absolute-position wrapper and 2 spaces for\n// them to float above.\n// *Some* emojis are 1 character wide, so this ends up being a bit wrong\n// sometimes, but better too much space than have things be cut off or\n// overlapping, which looks broken.\n// Due to limitations of the emoji-regex, some complex emojis will render\n// as their constituent parts rather than the conjoined glyph.\n\nimport emojiRegex from 'emoji-regex'\nconst EMOJI_RE = emojiRegex()\nconst replaceWide = (c: string) => replaceNarrow(c) + ' '\nconst replaceNarrow = (c: string) =>\n `<span style=\"position:absolute;line-height:1;margin-top:0.3ex\">${c}</span> `\nexport const fixEmoji = (s: string): string => {\n return s\n .replace(/[\\u2500-\\u25FF]/g, replaceNarrow)\n .replace(EMOJI_RE, replaceWide)\n}\n", "let COLOR = '#eeeeee'\nlet BACKGROUND = '#222222'\n\nexport const defaultColor = (s?: string) => {\n if (s) COLOR = s\n return COLOR\n}\n\nexport const defaultBackground = (s?: string) => {\n if (s) BACKGROUND = s\n return BACKGROUND\n}\n", "export const hexToRgb = (c: string): [number, number, number] => {\n c = c.replace(/^#/, '')\n if (c.length === 3) {\n const r = c.charAt(0)\n const g = c.charAt(1)\n const b = c.charAt(2)\n return hexToRgb(`${r}${r}${g}${g}${b}${b}`)\n }\n if (c.length !== 6) {\n throw new Error('invalid hex string: ' + c)\n }\n const r = parseInt(c.substring(0, 2), 16)\n const g = parseInt(c.substring(2, 4), 16)\n const b = parseInt(c.substring(4, 6), 16)\n if (r !== r || g !== g || b !== b) {\n throw new Error('invalid hex string: ' + c)\n }\n return [r, g, b]\n}\n", "export const rgbToHex = ([r, g, b]: [number, number, number]): string => {\n if (r !== r || g !== g || b !== b) {\n throw new Error('invalid RGB: ' + [r, g, b].join(','))\n }\n return `#${\n Math.max(0, Math.min(r, 255)).toString(16).padStart(2, '0') +\n Math.max(0, Math.min(g, 255)).toString(16).padStart(2, '0') +\n Math.max(0, Math.min(b, 255)).toString(16).padStart(2, '0')\n }`\n}\n", "import { hexToRgb } from './hex-to-rgb.js'\nimport { rgbToHex } from './rgb-to-hex.js'\n\nconst DIMLEVEL = 0.75\nexport const dimColor = (c: string): string =>\n rgbToHex(\n hexToRgb(c).map(c => Math.floor(c * DIMLEVEL)) as [\n number,\n number,\n number,\n ],\n )\n", "export const htmlEscape = (s: string): string =>\n s\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n", "export type Names =\n | 'black'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'magenta'\n | 'cyan'\n | 'white'\n\nexport type NameCodes = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7\n\nexport const nameCodes: { [name in Names]: NameCodes } = {\n black: 0b000,\n red: 0b001,\n green: 0b010,\n yellow: 0b011,\n blue: 0b100,\n magenta: 0b101,\n cyan: 0b110,\n white: 0b111,\n}\n\nexport const codeNames: ReadonlyArray<Names> = [\n 'black',\n 'red',\n 'green',\n 'yellow',\n 'blue',\n 'magenta',\n 'cyan',\n 'white',\n] as const\n\nexport const namedColors: Omit<string[], number> & {\n 0: string\n 1: string\n 2: string\n 3: string\n 4: string\n 5: string\n 6: string\n 7: string\n} = [\n '#000000',\n '#ff0000',\n '#00a000',\n '#e0e000',\n '#0040e0',\n '#e000e0',\n '#00b0b0',\n '#e0e0e0',\n]\n\nexport const namedBrightColors: Omit<string[], number> & {\n 0: string\n 1: string\n 2: string\n 3: string\n 4: string\n 5: string\n 6: string\n 7: string\n} = [\n '#404040',\n '#ff3030',\n '#00ff00',\n '#ffff00',\n '#0080ff',\n '#ff33ff',\n '#00ffff',\n '#ffffff',\n]\n", "import { NameCodes, namedBrightColors, namedColors } from './named.js'\n\nconst hex = (n: number) => n.toString(16).padStart(2, '0')\n\nconst colors = [\n ...(function* () {\n for (let red = 0; red < 6; red++) {\n for (let green = 0; green < 6; green++) {\n for (let blue = 0; blue < 6; blue++) {\n const r = red ? red * 40 + 55 : 0\n const g = green ? green * 40 + 55 : 0\n const b = blue ? blue * 40 + 55 : 0\n yield `#${hex(r)}${hex(g)}${hex(b)}`\n }\n }\n }\n })(),\n]\n\nconst grays = [\n ...(function* () {\n for (let gray = 0; gray < 24; gray++) {\n const g = gray * 10 + 8\n yield `#${hex(g).repeat(3)}`\n }\n })(),\n]\n\nexport const xtermCode = (n: number) => {\n if (n < 8) return namedColors[n as NameCodes]\n if (n < 16) return namedBrightColors[(n - 8) as NameCodes]\n if (n < Math.pow(6, 3)) return colors[n - 16] as string\n if (n < 256) return grays[n - 232] as string\n}\n", "// this object is deposited into the style buffer in the Terminal\n// every time a character is written to the character buffer.\n// Handles all parsing of \\x1b[...m ANSI codes and conversion to CSS.\nimport { defaultBackground, defaultColor } from './default-colors.js'\nimport { dimColor } from './dim-color.js'\nimport { hexToRgb } from './hex-to-rgb.js'\nimport { htmlEscape } from './html-escape.js'\nimport {\n NameCodes,\n nameCodes,\n namedBrightColors,\n namedColors,\n Names,\n} from './named.js'\nimport { rgbToHex } from './rgb-to-hex.js'\nimport { xtermCode } from './xterm.js'\n\nconst ALL_END = '0'\nconst BG_END = '49'\nconst BG_START = '48'\nconst BOLD_END = '22'\nconst BOLD_START = '1'\nconst DIM_START = '2'\n// DIM_END is the same as BOLD_END because it's really \"font-weight:normal\"\n// In practice, dim modifies color, not font-weight, since modern screens\n// have colors, and most terminal fonts don't distinguish font weights other\n// than normal and bold.\nconst FG_END = '39'\nconst FG_START = '38'\nconst INV_END = '27'\nconst INV_START = '7'\nconst ITALIC_END = '23'\nconst ITALIC_START = '3'\nconst OVER_END = '55'\nconst OVER_START = '53'\nconst STRIKE_END = '29'\nconst STRIKE_START = '9'\nconst UNDERLINE_END = '24'\nconst UNDERLINE_START = '4'\nconst UNDERLINE_START_2 = '21' // WHYYYYYY\n\nconst NAMED_RE = /^(3|4|9|10)([0-7])$/\nconst NAMED_FG = '3'\nconst NAMED_BG = '4'\nconst NAMED_FG_BRIGHT = '9'\nconst NAMED_BG_BRIGHT = '10'\n\n// verifies that the style code is something that a Style object can handle,\n// and captures the first code and its parameter.\n// first code: $1\n// href: $2\n// styles: $3\nconst VALID_CODE = () =>\n new RegExp(\n '\\x1b\\\\]8;;' + // OSC hyperlink\n '(.*?)' + // href\n '(?:\\x1b|\\x07)' + // ST\n '|' +\n '\\x1b\\\\[' + // style codes\n '([0-9]*(?:;[0-9]*)*)' + // code numbers\n 'm', // end style codes\n 'g',\n )\n\ntype ParsedValidCode =\n | null\n | (RegExpExecArray &\n ([string, string, undefined] | [string, undefined, string]))\n\n/**\n * The properties that can be set on Style objects\n */\nexport type StyleProps = {\n /** may be either a hex string, or a named color */\n background?: string\n bold?: boolean\n /** may be either a hex string, or a named color */\n color?: string\n dim?: boolean\n inverse?: boolean\n italic?: boolean\n overline?: boolean\n strike?: boolean\n underline?: boolean\n /** hyperlink target, must be a valid url or `''` */\n href?: string\n}\n\nconst RESET_STYLE: StyleProps = {\n background: '',\n bold: false,\n color: '',\n dim: false,\n inverse: false,\n italic: false,\n overline: false,\n strike: false,\n underline: false,\n}\nconst RESET_PROPS: StyleProps = {\n ...RESET_STYLE,\n href: '',\n}\n\nconst namedColor = (c: string, bright = false): string => {\n if (!c) return c\n c = c.toLowerCase()\n const code = nameCodes[c as Names]\n if (typeof code === 'number') {\n return (bright ? namedBrightColors[code] : namedColors[code]) as string\n }\n if (c.includes('bright') && !bright) {\n return namedColor(c.replace(/bright/g, ''), true)\n }\n return rgbToHex(hexToRgb(c))\n}\n\nconst SEEN = new Map<string, Style>()\n\n/**\n * An immutable representation of an ANSI style. Used by Terminal and Block\n * to represent the styles in use for text to be printed.\n * If a Style object is created with the same properties as a\n * formerly seen Style object, the same object will be returned.\n *\n * For example:\n *\n * ```js\n * const a = new Style({ bold: true })\n * const b = new Style({ bold: true })\n * assert.equal(a, b) // passes\n * ```\n *\n * This optimization cuts down considerably on object creation,\n * because a Style is created for each styled character written to\n * the Terminal buffer. It also means that Style objects can be\n * compared directly with `===` to test for equivalence.\n */\nexport class Style {\n #css?: string\n\n #background!: string\n #bold!: boolean\n #color!: string\n #dim!: boolean\n #inverse!: boolean\n #italic!: boolean\n #overline!: boolean\n #strike!: boolean\n #underline!: boolean\n #ansi!: string\n #href!: string\n\n constructor(styles: StyleProps | string) {\n const {\n background = '',\n bold = false,\n color = '',\n dim = false,\n inverse = false,\n italic = false,\n overline = false,\n strike = false,\n underline = false,\n href = '',\n } = typeof styles !== 'string' ? styles : Style.ansiProperties(styles)\n\n const ansi = Style.propertiesAnsi({\n background,\n bold,\n color,\n dim,\n inverse,\n italic,\n overline,\n strike,\n underline,\n href,\n })\n\n // same style = same object\n const seen = SEEN.get(ansi)\n if (seen) return seen\n SEEN.set(ansi, this)\n\n this.#ansi = ansi\n this.#background = namedColor(background)\n this.#bold = bold\n this.#color = namedColor(color)\n this.#dim = dim\n this.#inverse = inverse\n this.#italic = italic\n this.#overline = overline\n this.#strike = strike\n this.#underline = underline\n try {\n this.#href = href && String(new URL(href))\n } catch {\n this.#href = ''\n }\n }\n\n /**\n * True if this style is a full reset of all properties.\n */\n get isReset() {\n return this === RESET\n }\n\n /** corresponding ANSI code sequence for this style */\n get ansi() {\n return this.#ansi\n }\n\n /** Convert a set of properties to an ANSI style code */\n static propertiesAnsi(styles: StyleProps): string {\n const {\n background,\n bold,\n color,\n dim,\n inverse,\n italic,\n overline,\n strike,\n underline,\n href = '',\n } = styles\n const codes = [\n // always do a reset at the start\n 0,\n ...(color ? [FG_START, 2, ...hexToRgb(namedColor(color))] : []),\n ...(background ?\n [BG_START, 2, ...hexToRgb(namedColor(background))]\n : []),\n ...(bold ? [BOLD_START] : []),\n ...(dim ? [DIM_START] : []),\n ...(inverse ? [INV_START] : []),\n ...(italic ? [ITALIC_START] : []),\n ...(overline ? [OVER_START] : []),\n ...(strike ? [STRIKE_START] : []),\n ...(underline ? [UNDERLINE_START] : []),\n ]\n return `\\x1b]8;;${href}\\x1b\\\\\\x1b[${codes.join(';')}m`\n }\n\n /**\n * If the input string is a sequence of *only* ANSI style and\n * OSC href codes, returns the array of codes and their parameters.\n * Otherwise, returns false.\n */\n static validStyleCodes(s: string): null | [string, string][] {\n let c = 0\n let m: ParsedValidCode\n const results: [string, string][] = []\n const vc = VALID_CODE()\n while ((m = vc.exec(s) as ParsedValidCode)) {\n if (c !== m.index) {\n return null\n }\n c += m[0].length\n results.push([m[0], m[1] ?? m[2]])\n }\n return results.length === 0 ? null : results\n }\n\n /** a Style object that resets all properties */\n static get RESET() {\n return RESET\n }\n\n /** Convert an ANSI style code to a set of properties */\n static ansiProperties(code: string): StyleProps {\n const codes = Style.validStyleCodes(code)\n if (!codes) {\n throw new Error('invalid ansi style code: ' + JSON.stringify(code))\n }\n const style: StyleProps = {}\n for (const code of codes) {\n if (code[0].startsWith('\\x1b]8;;')) {\n style.href = code[1]\n continue\n }\n const codes = code[1].split(';')\n for (let i = 0; i < codes.length; i++) {\n const c = codes[i] as string\n switch (c) {\n case '':\n case ALL_END:\n Object.assign(style, RESET_STYLE)\n continue\n case BOLD_END:\n style.bold = false\n style.dim = false\n continue\n case ITALIC_END:\n style.italic = false\n continue\n case STRIKE_END:\n style.strike = false\n continue\n case OVER_END:\n style.overline = false\n continue\n case UNDERLINE_END:\n style.underline = false\n continue\n case INV_END:\n style.inverse = false\n continue\n case FG_END:\n style.color = ''\n continue\n case BG_END:\n style.background = ''\n continue\n case BOLD_START:\n style.bold = true\n continue\n case INV_START:\n style.inverse = true\n continue\n case UNDERLINE_START:\n case UNDERLINE_START_2:\n style.underline = true\n continue\n case DIM_START:\n style.dim = true\n continue\n case OVER_START:\n style.overline = true\n continue\n case ITALIC_START:\n style.italic = true\n continue\n case STRIKE_START:\n style.strike = true\n continue\n case BG_START:\n case FG_START: {\n // 2 for rgb, 5 for xterm\n const next = codes[i + 1]\n const prop = c == FG_START ? 'color' : 'background'\n switch (next) {\n case '5':\n const xt = codes[i + 2]\n const code = xt && xtermCode(parseInt(xt, 10))\n if (code) {\n i += 2\n style[prop] = code\n }\n continue\n case '2':\n const sr = codes[i + 2]\n const sg = codes[i + 3]\n const sb = codes[i + 4]\n if (sr && sg && sb) {\n const r = parseInt(sr, 10)\n const g = parseInt(sg, 10)\n const b = parseInt(sb, 10)\n const hex = rgbToHex([r, g, b])\n if (\n r <= 255 &&\n r >= 0 &&\n g <= 255 &&\n g >= 0 &&\n b <= 255 &&\n b >= 0\n ) {\n i += 4\n style[prop] = hex\n }\n }\n }\n continue\n }\n // named color/bg\n default: {\n const m = c.match(NAMED_RE) as\n | null\n | (RegExpMatchArray & [string, string, string])\n if (!m) continue\n const color = parseInt(m[2], 10) as NameCodes\n switch (m[1]) {\n case NAMED_FG:\n style.color = namedColors[color]\n continue\n case NAMED_BG:\n style.background = namedColors[color]\n continue\n case NAMED_FG_BRIGHT:\n style.color = namedBrightColors[color]\n continue\n case NAMED_BG_BRIGHT:\n style.background = namedBrightColors[color]\n continue\n }\n }\n }\n }\n }\n return style\n }\n\n /**\n * Return a new Style with this one plus the updated properties.\n *\n * If a string is provided, must be a valid set of style and OSC hyperlink\n * ANSI code, though unrecognized parameters within that code will be ignored\n * rather than throwing an error.\n */\n update(properties: StyleProps | string): Style {\n const {\n background = this.#background,\n bold = this.#bold,\n color = this.#color,\n dim = this.#dim,\n inverse = this.#inverse,\n italic = this.#italic,\n overline = this.#overline,\n strike = this.#strike,\n underline = this.#underline,\n href = this.#href,\n } =\n typeof properties === 'string' ?\n Style.ansiProperties(properties)\n : properties\n\n return (\n background === this.#background &&\n bold === this.#bold &&\n color === this.#color &&\n dim === this.#dim &&\n inverse === this.#inverse &&\n italic === this.#italic &&\n overline === this.#overline &&\n strike === this.#strike &&\n underline === this.#underline &&\n href === this.#href\n ) ?\n this\n : new Style({\n background,\n bold,\n color,\n dim,\n inverse,\n italic,\n overline,\n strike,\n underline,\n href,\n })\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](\n _: any,\n { colors }: { colors: boolean } = { colors: false },\n ) {\n const { ansi } = this\n return `Style { ${colors ? ansi : ''}${ansi.replace(/\\x1b/g, '^[')}${\n colors ? '\\x1b]8;;\\x1b\\\\\\x1b[m' : ''\n } }`\n }\n\n /**\n * Wrap the input string in the appropriate HTML for this style\n */\n wrap(s: string) {\n const css = this.toString()\n const href = this.#href\n if (!css && !href) return htmlEscape(s)\n const tag = href ? `a` : 'span'\n return `<${tag}${href ? ` href=\"${href}\"` : ''}${\n css ? ` style=\"${css}\"` : ''\n }>${htmlEscape(s)}</${tag}>`\n }\n\n /**\n * Return just the CSS for the styles. Href is not relevant.\n */\n toString() {\n if (this.#css) return this.#css\n let color = this.#inverse ? this.#background : this.#color\n let background = this.#inverse ? this.#color : this.#background\n if (this.#inverse) {\n color ||= defaultBackground()\n background ||= defaultColor()\n }\n // dim text is a different color, unless the background is the same\n // color, and set to something other than default. !?!? hwyyyyyyy idgi\n if (this.#dim && !(color && color === background)) {\n color = dimColor(color || defaultColor())\n }\n const textDecoration = [\n ...(this.#underline ? ['underline'] : []),\n ...(this.#overline ? ['overline'] : []),\n ...(this.#strike ? ['line-through'] : []),\n ].join(' ')\n\n return (this.#css = [\n ...(textDecoration ? [`text-decoration:${textDecoration}`] : []),\n ...(this.#bold ? ['font-weight:bold']\n : this.#dim ? ['font-weight:100']\n : []),\n ...(this.#italic ? ['font-style:italic'] : []),\n ...(color ? [`color:${color}`] : []),\n ...(background ? [`background:${background}`] : []),\n ].join(';'))\n }\n}\n\nconst RESET = new Style(RESET_PROPS)\n", "import { InspectOptions } from 'util'\nimport { fixEmoji } from './fix-emoji.js'\nimport { Style } from './style.js'\n\n/**\n * A representation of a run of text in a given style\n */\nexport class Block {\n #style?: Style\n #text: string\n\n constructor(text: string, style?: Style) {\n this.#text = text\n this.#style = style\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](\n _: any,\n opts: InspectOptions,\n inspect: typeof import('util').inspect,\n ) {\n return `Block {${\n this.#style ? ' ' + inspect(this.#style, opts) : ''\n } ${inspect(this.#text, opts)} }`\n }\n\n /** return the block as a styled `<span>` tag */\n toString() {\n return this.#toString(false)\n }\n\n /** a representation of the block as an ANSI styled string */\n get ansi() {\n return this.#toString(true)\n }\n\n #toString(ansi: boolean) {\n return (\n !this.#text ? ''\n : ansi ? (this.#style ?? Style.RESET).ansi + this.#text\n : fixEmoji((this.#style ?? Style.RESET).wrap(this.#text))\n )\n }\n\n /** append text to the block */\n write(c: string) {\n this.#text += c\n return this\n }\n\n /** the raw text that will be written */\n get text() {\n return this.#text\n }\n\n /** the Style used by this block */\n get style() {\n return this.#style\n }\n}\n", "import { InspectOptions } from 'util'\nimport { Block } from './block.js'\nimport { defaultBackground, defaultColor } from './default-colors.js'\nimport { Style, StyleProps } from './style.js'\nconst CODES_RE =\n /^\\u001b\\[([0-9]*[A-GJKSTg]|([0-9;]*)m|([0-9]*;?[0-9]*)?[Hf]|\\?[0-9]+[hl])/\n\nconst OSC_RE = /^\\u001b\\](.*?)(?:\\u0007|\\u001b\\\\)/\nconst OSC_TITLE = '0;'\nconst OSC_HREF = '8;;'\n\n/**\n * A representation of a virtual \"terminal\" where we write out the character\n * and style information as we parse through the ANSI encoded stream.\n *\n * Important: this is *not* a full-fledged Stream class. You can write to it\n * multiple times, and it will update appropriately, but it does zero buffering\n * or input validation, so writing a partial ANSI code sequence will result in\n * mochibake in the output.\n *\n * The virtual terminal is an infinitely high and wide screen, with no\n * scrollback buffer. So, when `scrollDown(n)` is called (either explicitly, or\n * with a `\\x1b[<n>S` ANSI code), `n` lines are removed from the top of the\n * \"screen\". When `scrollUp(n)` is called (explicitly or via a `\\x1b[<n>T` ANSI\n * code), `n` _empty_ lines are added to the top of the screen; the lines lost\n * to a previous `scrollDown` action are not restored when scrolling up.\n *\n * Also, actions that move the cursor down or to the right, which would on a\n * normal physical terminal be limited to the height/width of the terminal, are\n * unbounded. For example, on an actual terminal, `echo $'\\x1b[1000Bhello'`\n * will print \"hello\" at the bottom of the screen (unless your screen happens\n * to be more than 1000 lines high); in this virtual terminal, it will create\n * 1000 empty lines.\n *\n * Most of the methods (other than `toString()` of course) return `this`,\n * allowing for things like this:\n *\n * ```js\n * console.log(\n * new Terminal()\n * .setStyle({ color: '#ff0000' })\n * .write('hello, ')\n * .down(1)\n * .setStyle({ inverse: true })\n * .write('world!').ansi\n * )\n * ```\n */\nexport class Terminal {\n // note: 0-indexed, but all the ansi codes are 1-indexed\n #cursor: [number, number] = [0, 0]\n // character data\n #text: string[][] = []\n // the style used to write it\n #style: (Style | undefined)[][] = []\n // the current style we use to paint characters to our \"screen\"\n #brush: Style = new Style({})\n\n #title: string = ''\n #blocks?: Block[]\n\n constructor(input?: string) {\n if (input) this.write(input)\n }\n\n /**\n * Set the style that the terminal will use for text writes.\n *\n * If a string, must be a valid `\\x1b[...m` ANSI style code.\n *\n * The styles provided will be appended onto the current style in use, just\n * as they would be by a real terminal if the relevant ANSI code is\n * encountered.\n */\n setStyle(style: string | StyleProps): Terminal {\n this.#brush = this.#brush.update(style)\n return this\n }\n\n /** Move the cursor up `n` lines, stopping at the top. */\n up(n: number): Terminal {\n this.#cursor[0] = Math.max(this.#cursor[0] - n, 0)\n return this\n }\n\n /** Move the cursor down `n` lines, without limit. */\n down(n: number): Terminal {\n // move down\n // in real life, this would be maxed to the size of the screen buffer,\n // but since this virtual terminal is an infinitely high and wide screen,\n // we just let it create new lines.\n this.#cursor[0] += n\n return this\n }\n\n /**\n * Prepend `n` empty lines at the start of the buffer, effectively moving the\n * cursor up as a result.\n */\n scrollUp(n: number): Terminal {\n // add n lines at the start of the buffer\n // leaves the cursor at the same index it was at before, effectively\n // moving it up as a result.\n for (let i = 0; i < n; i++) {\n this.#text.unshift([])\n this.#style.unshift([])\n }\n return this\n }\n\n /**\n * Remove `n` lines from the start of the buffer, effectively moving the\n * cursor down as a result.\n */\n scrollDown(n: number): Terminal {\n // remove lines from the top of the buffer, effectively moving\n // the cursor down as a result.\n // TODO: Maybe it would be good to keep a scrollback buffer,\n // and move lines into/out of there on scroll?\n for (let i = 0; i < n; i++) {\n this.#text.shift()\n this.#style.shift()\n }\n return this\n }\n\n /** Move the cursor forward `n` columns, without limit. */\n forward(n: number): Terminal {\n this.#cursor[1] += n\n return this\n }\n\n /** Move the cursor back `n` columns, stopping at the first column. */\n back(n: number): Terminal {\n this.#cursor[1] = Math.max(0, this.#cursor[1] - n)\n return this\n }\n\n /** Move to the start of the `n`-th next line. */\n nextLine(n: number): Terminal {\n this.#cursor[0] += n\n this.#cursor[1] = 0\n return this\n }\n\n /**\n * Move to the start of the `n`-th previous line, stopping at the top of the\n * screen.\n */\n prevLine(n: number): Terminal {\n this.#cursor[0] = Math.max(0, this.#cursor[0] - n)\n this.#cursor[1] = 0\n return this\n }\n\n /**\n * Move to the `n`-th column (1-indexed), limited by the left-most column.\n */\n horizontalPosition(n: number): Terminal {\n this.#cursor[1] = Math.max(0, n - 1)\n return this\n }\n\n /**\n * Move to the 1-indexed row and column specified, limited by the top and\n * left sides of the screen.\n */\n position(row: number, col: number): Terminal {\n this.#cursor[0] = Math.max(row - 1, 0)\n this.#cursor[1] = Math.max(col - 1, 0)\n return this\n }\n\n /**\n * Delete all printed data from the screen.\n *\n * Note that this is used for both `\\x1b[2J` _and_ `\\x1b[3J`, because there\n * is no scrollback buffer in this virtual terminal.\n */\n eraseScreen(): Terminal {\n // erase entire screen\n this.#text.length = 0\n this.#style.length = 0\n return this\n }\n\n /** Delete all printed data from the cursor to the end of the screen. */\n eraseScreenToEnd(): Terminal {\n // erase from cursor to end of screen\n this.#text.splice(this.#cursor[0] + 1)\n this.#style.splice(this.#cursor[0] + 1)\n this.eraseLineToEnd()\n return this\n }\n\n /** Delete all printed data from the top of the screen to the cursor. */\n eraseScreenFromStart(): Terminal {\n // erase from beginning of screen to cursor\n let i\n for (i = 0; i < this.#cursor[0]; i++) {\n const line = this.#text[i]\n const sline = this.#style[i]\n /* c8 ignore start */\n if (!line || !sline) continue\n /* c8 ignore stop */\n line.length = 0\n sline.length = 0\n }\n this.eraseLineFromStart()\n return this\n }\n\n /** Delete the contents of the current line. */\n eraseLine(): Terminal {\n const line = this.#text[this.#cursor[0]]\n const sline = this.#style[this.#cursor[0]]\n if (!line || !sline) return this\n line.length = 0\n sline.length = 0\n return this\n }\n\n /**\n * Delete printed data from the cursor to the end of the current line.\n */\n eraseLineToEnd(): Terminal {\n const line = this.#text[this.#cursor[0]]\n const sline = this.#style[this.#cursor[0]]\n if (!line || !sline) return this\n // from cursor to end of line\n line.splice(this.#cursor[1])\n sline.splice(this.#cursor[1])\n return this\n }\n\n /**\n * Delete printed data from the start of the current line to the cursor.\n */\n eraseLineFromStart(): Terminal {\n if (this.#cursor[1] === 0) return this.eraseLine()\n /* c8 ignore start */\n const line = this.#text[this.#cursor[0]]\n const sline = this.#style[this.#cursor[0]]\n /* c8 ignore stop */\n if (!line || !sline) return this\n for (let i = 0; i < this.#cursor[1]; i++) {\n line[i] = ' '\n sline[i] = undefined\n }\n return this\n }\n\n /**\n * Parse the ANSI encoded string provided, updating the internal character\n * and style buffers appropriately.\n */\n write(input: string): Terminal {\n this.#blocks = undefined\n // remove title-setting sequences\n for (let c = 0; c < input.length; ) {\n while (input.charAt(c) === '\\x1b') {\n // codes that don't use the OSC or CSI code\n switch (input.charAt(c + 1)) {\n case 'B':\n this.horizontalPosition(1)\n c += 2\n continue\n case 'H':\n // tab stops, not supported, ignore\n c += 2\n continue\n case 'D':\n this.scrollDown(1)\n c += 2\n continue\n case 'M':\n this.scrollUp(1)\n c += 2\n continue\n }\n\n // cursor/screen motion/erase commands\n const code = input.substring(c).match(CODES_RE) as\n | null\n | (RegExpMatchArray & [string, string])\n if (code) {\n c += code[0].length\n if (code[1].endsWith('m')) {\n // style code\n this.setStyle(code[0])\n continue\n } else {\n const x = code[1].charAt(code[1].length - 1)\n if (x === 'H' || x === 'f') {\n // cursor position\n const [n, m] = code[1].replace(/[Hf]$/, '').split(';')\n const row = Math.max(1, parseInt(n || '1', 10))\n const col = Math.max(1, parseInt(m || '1', 10))\n this.position(row, col)\n continue\n }\n // these all have an optional 1-indexed parameter\n // that defaults to 1, except J and K which default to 0\n const p = code[1].match(/^([0-9]+)/)?.[1]\n const n = parseInt(p || '1', 10)\n const z = parseInt(p || '0', 10)\n switch (x) {\n case 'A':\n this.up(n)\n continue\n case 'T':\n this.scrollUp(n)\n continue\n case 'B':\n this.down(n)\n continue\n case 'S':\n this.scrollDown(n)\n continue\n case 'C':\n this.forward(n)\n continue\n case 'D':\n this.back(n)\n continue\n case 'E':\n this.nextLine(n)\n continue\n case 'F':\n this.prevLine(n)\n continue\n case 'G':\n this.horizontalPosition(n)\n continue\n case 'J': {\n switch (z) {\n case 0:\n this.eraseScreenToEnd()\n continue\n case 1:\n this.eraseScreenFromStart()\n continue\n case 2:\n case 3:\n this.eraseScreen()\n continue\n }\n continue\n }\n case 'K': {\n switch (z) {\n case 0:\n this.eraseLineToEnd()\n continue\n case 1:\n this.eraseLineFromStart()\n continue\n case 2:\n this.eraseLine()\n continue\n }\n continue\n }\n }\n }\n continue\n }\n\n // check for OSC (title and hyperlinks)\n const osc = input.substring(c).match(OSC_RE) as\n | null\n | (RegExpMatchArray & [string, string])\n if (osc?.index === 0) {\n c += osc[0].length\n const cmd = osc[1]\n if (cmd.startsWith(OSC_TITLE)) {\n this.setTitle(cmd.substring(OSC_TITLE.length))\n continue\n }\n if (cmd.startsWith(OSC_HREF)) {\n this.setStyle({ href: cmd.substring(OSC_HREF.length) })\n continue\n }\n continue\n }\n\n // some other code we don't support, treat as text\n break\n }\n\n // end parsing ansi codes, might have walked off the input\n if (c >= input.length) break\n\n const ch = input.charAt(c++)\n\n if (ch === '\\r') {\n this.horizontalPosition(1)\n continue\n }\n if (ch === '\\n') {\n this.nextLine(1)\n continue\n }\n\n // write a character\n // if we are off the painted terminal, paint up to that point\n while (this.#text.length < this.#cursor[0]) {\n this.#text.push([])\n this.#style.push([])\n }\n const sline = this.#style[this.#cursor[0]] || []\n const line = this.#text[this.#cursor[0]] || []\n while (line.length < this.#cursor[1]) {\n line.push(' ')\n }\n while (sline.length < this.#cursor[1]) {\n sline.push(undefined)\n }\n line[this.#cursor[1]] = ch\n sline[this.#cursor[1]] =\n this.#brush.isReset ? undefined : this.#brush\n this.#style[this.#cursor[0]] = sline\n this.#text[this.#cursor[0]] = line\n this.forward(1)\n }\n return this\n }\n\n /**\n * Called when an OSC code of `\\x1b]0;...\\x1b\\` is encountered.\n *\n * Sets the `title` attribute on the root `<pre>` in html output,\n * and creates a corresponding OSC title sequence in the ansi output.\n */\n setTitle(s: string) {\n this.#title = s\n return this\n }\n\n /** the raw unstyled text of each line */\n get text() {\n return this.#text.map(l => l.join(''))\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](\n _: any,\n opts: InspectOptions,\n inspect: typeof import('util').inspect,\n ) {\n const ins = inspect(\n {\n cursor: this.#cursor,\n brush: this.#brush,\n text: this.#text.map(l => l.join('')),\n blocks: this.blocks,\n },\n opts,\n )\n return `Terminal ${ins}`\n }\n\n /**\n * Output the results of the style and character buffers as ANSI\n * styled text. This effectively normalizes all color codes to explicit\n * RGB values and resolves all cursor motions and other control codes,\n * and styling runs of identical styles with a single code.\n */\n get ansi() {\n return this.#toString(true)\n }\n\n /**\n * Output the results of the style and character buffers as a `<pre>`\n * tag with `<span>` elements setting effective styles.\n */\n toString() {\n return this.#toString(false)\n }\n\n /**\n * An array of `Block` objects each representing a string of text with a\n * given style.\n */\n get blocks(): Block[] {\n if (this.#blocks) return this.#blocks\n let cur: Block = new Block('')\n const blocks: Block[] = [cur]\n for (let i = 0; i < this.#text.length; i++) {\n /* c8 ignore start */\n const line = this.#text[i] || []\n const sline = this.#style[i] || []\n /* c8 ignore stop */\n for (let j = 0; j < line.length; j++) {\n const st = sline[j]\n // will always be set\n /* c8 ignore start */\n const ch = line[j] || ''\n /* c8 ignore stop */\n if (st === cur.style) cur.write(ch)\n else blocks.push((cur = new Block(ch, st)))\n }\n // append a \\n only if we're not at the end\n if (this.#text[i + 1]) cur.write('\\n')\n }\n return (this.#blocks = blocks.filter(b => !!b.text))\n }\n\n #toString(ansi: boolean) {\n // turn into an array of [string, Style?], concatenating runs\n // of the same style into a single string.\n const contents = this.blocks\n .map(b => (ansi ? b.ansi : b.toString()))\n .join('')\n if (ansi) {\n const title = this.#title ? `\\x1b]0;${this.#title}\\x1b\\\\` : ''\n return title + contents + '\\x1b[m'\n }\n const css = Object.entries({\n color: defaultColor(),\n background: defaultBackground(),\n position: 'relative',\n })\n .map(kv => kv.join(':'))\n .join(';')\n const preStyle = `style=\"${css}\"`\n const preTitle = this.#title ? ` title=\"${this.#title}\"` : ''\n return `<pre ${preStyle}${preTitle}>${contents}</pre>`\n }\n}\n", "export * from './block.js'\nexport * from './default-colors.js'\nexport * from './named.js'\nexport * from './xterm.js'\nexport * from './style.js'\nexport * from './terminal.js'\nexport * from './theme.js'\nimport { Terminal } from './terminal.js'\n\n/**\n * Convert a string of ANSI text into an HTML `<pre>` tag.\n */\nexport const ansiToPre = (input: string) => String(new Terminal(input))\n\n/**\n * Convert a string of ANSI text into a string of ANSI text with normalized\n * RGB color codes and all cursor control sequences resolved.\n */\nexport const ansiToAnsi = (input: string) => new Terminal(input).ansi\n", "/**\n * impl for `vlt run`, `vlt run-exec`, `vlt exec-local`, `vlt exec`\n * @module\n */\n\nimport { error } from '@vltpkg/error-cause'\nimport { isErrorWithCause } from '@vltpkg/types'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type {\n exec,\n execFG,\n ExecOptions,\n run,\n runExec,\n runExecFG,\n RunExecOptions,\n runFG,\n RunFGResult,\n RunOptions,\n RunResult,\n} from '@vltpkg/run'\nimport { Query } from '@vltpkg/query'\nimport { actual } from '@vltpkg/graph'\nimport { isRunResult } from '@vltpkg/run'\nimport { Monorepo } from '@vltpkg/workspaces'\nimport { ansiToAnsi } from 'ansi-to-pre'\nimport type { LoadedConfig } from './config/index.ts'\nimport { stderr, stdout, styleTextStdout } from './output.ts'\nimport type { Views } from './view.ts'\nimport type { SpawnResultStdioStrings } from '@vltpkg/promise-spawn'\nimport assert from 'node:assert'\nimport { resolve } from 'node:path'\nimport { createHostContextsMap } from './query-host-contexts.ts'\n\nexport type RunnerBG = typeof exec | typeof run | typeof runExec\nexport type RunnerFG = typeof execFG | typeof runExecFG | typeof runFG\nexport type RunnerOptions = ExecOptions & RunExecOptions & RunOptions\nexport type MultiRunResult = Record<string, RunResult>\nexport type ScriptSet = Record<string, string>\nexport type MultiScriptSet = Record<string, ScriptSet>\nexport type ExecResult =\n | RunFGResult\n | MultiRunResult\n | ScriptSet\n | MultiScriptSet\n\nconst isScriptSet = (o: unknown): o is ScriptSet => {\n if (!o || typeof o !== 'object') return false\n for (const v of Object.values(o)) {\n if (typeof v !== 'string') return false\n }\n return true\n}\n\nconst isMultiScriptSet = (\n o: ExecResult,\n): o is Record<string, ScriptSet> => {\n for (const v of Object.values(o)) {\n if (!isScriptSet(v)) return false\n }\n return true\n}\n\nconst isSingleSuccess = (\n o: RunResult,\n): o is RunResult & { status: 0; signal: null } =>\n o.signal === null && o.status === 0\n\nconst setExitCode = (result: RunResult) => {\n /* c8 ignore next */\n process.exitCode ||= result.status ?? 1\n}\n\nexport const views = {\n // run results for single or multiple will be printed along the way.\n human: result => {\n if (isScriptSet(result)) stdout('Scripts available:', result)\n else if (isMultiScriptSet(result)) {\n stdout('Scripts available:')\n for (const [path, scripts] of Object.entries(result)) {\n stdout(path, scripts)\n }\n }\n },\n json: result =>\n isRunResult(result) && isSingleSuccess(result) ?\n undefined\n : result,\n} as const satisfies Views<ExecResult>\n\ntype ViewValues = 'human' | 'json' | 'inspect' | 'silent'\n\nexport class ExecCommand<B extends RunnerBG, F extends RunnerFG> {\n bg: B\n fg: F\n arg0?: string\n args: string[]\n env?: NodeJS.ProcessEnv\n #monorepo?: Monorepo\n #nodes?: string[]\n #defaultIgnoreMissing = false\n conf: LoadedConfig\n projectRoot: string\n view: ViewValues\n validViewValues = new Map<string, ViewValues>([\n ['human', 'human'],\n ['json', 'json'],\n ['inspect', 'inspect'],\n ['silent', 'silent'],\n ])\n\n constructor(conf: LoadedConfig, bg: B, fg: F) {\n this.conf = conf\n this.bg = bg\n this.fg = fg\n this.view = this.validViewValues.get(conf.values.view) ?? 'human'\n const {\n projectRoot,\n positionals: [arg0, ...args],\n } = conf\n this.arg0 = arg0\n this.args = args\n this.projectRoot = projectRoot\n }\n\n #targetCount(): number {\n if (this.#nodes) return this.#nodes.length\n return this.#monorepo?.size ?? 1\n }\n\n hasArg0(): this is this & { arg0: string } {\n return !!this.arg0\n }\n\n async run(): Promise<ExecResult> {\n const { conf } = this\n\n const queryString = conf.get('scope')\n const paths = conf.get('workspace')\n const groups = conf.get('workspace-group')\n const recursive = conf.get('recursive')\n\n // scope takes precedence over workspaces or groups\n if (queryString) {\n this.#defaultIgnoreMissing = true\n const mainManifest = conf.options.packageJson.maybeRead(\n this.projectRoot,\n )\n let graph\n if (mainManifest) {\n graph = actual.load({\n ...conf.options,\n mainManifest,\n monorepo: Monorepo.load(this.projectRoot),\n loadManifests: false,\n })\n }\n const hostContexts = await createHostContextsMap(conf)\n const query = new Query({\n /* c8 ignore start */\n nodes: graph ? new Set(graph.nodes.values()) : new Set(),\n edges: graph?.edges ?? new Set(),\n importers: graph?.importers ?? new Set(),\n /* c8 ignore stop */\n securityArchive: undefined,\n hostContexts,\n })\n const { nodes } = await query.search(queryString, {\n signal: new AbortController().signal,\n })\n this.#nodes = []\n for (const node of nodes) {\n const { location } = node.toJSON()\n assert(\n location,\n error(`node ${node.id} has no location`, {\n found: node,\n }),\n )\n this.#nodes.push(location)\n }\n } else if (paths?.length || groups?.length || recursive) {\n this.#defaultIgnoreMissing = true\n this.#monorepo = Monorepo.load(this.projectRoot, {\n load: { paths, groups },\n })\n }\n\n if (this.#targetCount() === 1) {\n const arg = this.fgArg()\n if (!arg) return this.noArgsSingle()\n const result = await this.fg(arg)\n if (isRunResult(result)) {\n setExitCode(result)\n }\n return result\n }\n\n if (this.#targetCount() === 0) {\n if (queryString) {\n throw error('no matching nodes found for query', {\n found: queryString,\n })\n } else {\n throw error('no matching workspaces found', {\n /* c8 ignore next - already guarded */\n validOptions: [...(this.#monorepo?.load().paths() ?? [])],\n })\n }\n }\n\n if (!this.hasArg0()) {\n return this.noArgsMulti()\n }\n\n // run across workspaces\n let failed = false as boolean\n const runInDir = async (cwd: string, label: string) => {\n const result = await this.bg(this.bgArg(cwd)).catch(\n (er: unknown) => {\n if (isErrorWithCause(er) && isRunResult(er.cause)) {\n this.printResult(label, er.cause)\n }\n failed = true\n throw er\n },\n )\n // If we are allowed to ignore missing commands, then command might be\n // an emptry string. If so, we don't print anything and return null to\n // be filtered out later.\n if (!result.command) return null\n if (!failed) this.printResult(label, result)\n return result\n }\n\n const resultMap = new Map<string, SpawnResultStdioStrings>()\n if (this.#nodes) {\n for (const { label, cwd } of this.getTargets()) {\n const result = await runInDir(cwd, label)\n if (result) resultMap.set(label, result)\n }\n } else if (this.#monorepo) {\n const wsResultMap = await this.#monorepo.run(ws =>\n runInDir(ws.fullpath, ws.path),\n )\n for (const [ws, result] of wsResultMap) {\n if (result) resultMap.set(ws.path, result)\n }\n }\n\n const results: Record<string, RunResult> = {}\n for (const [path, result] of resultMap) {\n if (result.status === 0 && result.signal === null) {\n result.stdout = ''\n result.stderr = ''\n }\n results[path] = result\n }\n return results\n }\n\n printResult(path: string, result: RunResult) {\n // non-human results just get printed at the end\n if (this.view !== 'human') return\n\n if (result.status === 0 && result.signal === null) {\n stdout(path, 'ok')\n } else {\n stdout(\n styleTextStdout(\n ['bgWhiteBright', 'black', 'bold'],\n path + ' failure',\n ),\n {\n status: result.status,\n signal: result.signal,\n },\n )\n /* c8 ignore start */\n if (result.stderr) stderr(ansiToAnsi(result.stderr))\n if (result.stdout) stdout(ansiToAnsi(result.stdout))\n /* c8 ignore stop */\n setExitCode(result)\n }\n }\n\n /* c8 ignore start - env specific */\n interactiveShell(): string {\n return (\n process.env.SHELL ??\n this.conf.get('script-shell') ??\n (process.platform === 'win32' ? 'cmd.exe' : '/bin/sh')\n )\n }\n /* c8 ignore stop */\n\n // overridden by 'vlt run' which returns undefined\n defaultArg0(): string | undefined {\n return this.interactiveShell()\n }\n\n getCwd(): string {\n if (this.#nodes) {\n const [first] = this.#nodes\n assert(first, error('no nodes found'))\n return resolve(this.projectRoot, first)\n }\n // When no workspace/monorepo targeting is specified, use the current\n // working directory. This matches npx behavior and is required for\n // tools like node-gyp that must run in the correct directory.\n return (\n this.#monorepo?.values().next().value?.fullpath ?? process.cwd()\n )\n }\n\n fgArg(): RunnerOptions | undefined {\n const cwd = this.getCwd()\n const arg0 = this.arg0 ?? this.defaultArg0()\n\n // return undefined so noArgsSingle will be called instead\n if (typeof arg0 !== 'string') return\n\n return {\n cwd,\n arg0,\n args: this.args,\n env: this.env,\n projectRoot: this.projectRoot,\n packageJson: this.conf.options.packageJson,\n 'script-shell':\n this.arg0 ? this.conf.get('script-shell') : false,\n }\n }\n\n bgArg(this: this & { arg0: string }, cwd: string): RunnerOptions {\n return {\n cwd,\n acceptFail: !this.conf.get('bail'),\n ignoreMissing:\n this.conf.get('if-present') ?? this.#defaultIgnoreMissing,\n arg0: this.arg0,\n args: this.args,\n env: this.env,\n projectRoot: this.projectRoot,\n packageJson: this.conf.options.packageJson,\n 'script-shell': this.conf.get('script-shell'),\n }\n }\n\n /* c8 ignore start - not used, only here to override */\n noArgsSingle(): ScriptSet {\n throw error('Failed to determine interactive shell to spawn')\n }\n /* c8 ignore stop - not used, only here to override */\n\n noArgsMulti(): MultiScriptSet {\n throw error(\n 'Cannot spawn interactive shells in multiple workspaces',\n )\n }\n\n getTargets(): {\n label: string\n cwd: string\n manifest: NormalizedManifest\n }[] {\n const targets = []\n if (this.#nodes) {\n for (const location of this.#nodes) {\n const manifest = this.conf.options.packageJson.read(location)\n const label =\n /* c8 ignore next */\n location.startsWith('./') ? location.slice(2) : location\n const cwd = resolve(this.projectRoot, location)\n targets.push({ label, cwd, manifest })\n }\n } else if (this.#monorepo) {\n this.#monorepo.runSync(ws => {\n targets.push({\n label: ws.path,\n cwd: ws.fullpath,\n manifest: ws.manifest,\n })\n })\n }\n return targets\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,yBAAuB;AACvB,IAAM,eAAW,mBAAAA,SAAU;AAC3B,IAAM,cAAc,CAAC,MAAc,cAAc,CAAC,IAAI;AACtD,IAAM,gBAAgB,CAAC,MACrB,kEAAkE,CAAC;AAC9D,IAAM,WAAW,CAAC,MAAqB;AAC5C,SAAO,EACJ,QAAQ,oBAAoB,aAAa,EACzC,QAAQ,UAAU,WAAW;AAClC;;;ACpBA,IAAI,QAAQ;AACZ,IAAI,aAAa;AAEV,IAAM,eAAe,CAAC,MAAc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AAA,MAC/B,gBAAgB,KAAK,KAAK,IAAI,cAAc;AAAA,IAC9C;AAAA,EACF;AAAA;AAAA,EAGA,eAA0B;AACxB,UAAM,MAAM,gDAAgD;AAAA,EAC9D;AAAA;AAAA,EAGA,cAA8B;AAC5B,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAAA,EAEA,aAII;AACF,UAAM,UAAU,CAAC;AACjB,QAAI,KAAK,QAAQ;AACf,iBAAW,YAAY,KAAK,QAAQ;AAClC,cAAM,WAAW,KAAK,KAAK,QAAQ,YAAY,KAAK,QAAQ;AAC5D,cAAM;AAAA;AAAA,UAEJ,SAAS,WAAW,IAAI,IAAI,SAAS,MAAM,CAAC,IAAI;AAAA;AAClD,cAAM,MAAM,QAAQ,KAAK,aAAa,QAAQ;AAC9C,gBAAQ,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC;AAAA,MACvC;AAAA,IACF,WAAW,KAAK,WAAW;AACzB,WAAK,UAAU,QAAQ,QAAM;AAC3B,gBAAQ,KAAK;AAAA,UACX,OAAO,GAAG;AAAA,UACV,KAAK,GAAG;AAAA,UACR,UAAU,GAAG;AAAA,QACf,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": ["emojiRegex", "r", "g", "b", "c", "code", "codes", "hex", "colors", "n"]
|
|
7
7
|
}
|
|
@@ -5184,9 +5184,9 @@ async function getNodeGypShim() {
|
|
|
5184
5184
|
}
|
|
5185
5185
|
await mkdir(runtimeDir, { recursive: true });
|
|
5186
5186
|
const shimContent = process.platform === "win32" ? `@echo off
|
|
5187
|
-
vlx node-gyp@latest %*
|
|
5187
|
+
vlx --yes node-gyp@latest %*
|
|
5188
5188
|
` : `#!/bin/sh
|
|
5189
|
-
exec vlx node-gyp@latest "$@"
|
|
5189
|
+
exec vlx --yes node-gyp@latest "$@"
|
|
5190
5190
|
`;
|
|
5191
5191
|
await writeFile(shimFile, shimContent, "utf8");
|
|
5192
5192
|
if (process.platform !== "win32") {
|
|
@@ -5261,7 +5261,20 @@ var runImpl = async (options, execImpl, empty2) => {
|
|
|
5261
5261
|
const untrustworthy = !!(manifest?.gypfile && arg0 === "install" && manifest.scripts?.install === "node-gyp rebuild");
|
|
5262
5262
|
const pj = (untrustworthy ? void 0 : manifest) ?? packageJson.read(options.cwd);
|
|
5263
5263
|
const { scripts: scripts2 } = pj;
|
|
5264
|
-
|
|
5264
|
+
let command = scripts2?.[arg0];
|
|
5265
|
+
if (!command && arg0 === "install") {
|
|
5266
|
+
const hasNoInstallScripts = !scripts2?.install && !scripts2?.preinstall;
|
|
5267
|
+
if (hasNoInstallScripts) {
|
|
5268
|
+
try {
|
|
5269
|
+
const bindingGypPath = resolve2(options.cwd, "binding.gyp");
|
|
5270
|
+
const hasBindingGyp = statSync(bindingGypPath).isFile();
|
|
5271
|
+
if (hasBindingGyp) {
|
|
5272
|
+
command = "node-gyp rebuild";
|
|
5273
|
+
}
|
|
5274
|
+
} catch {
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
}
|
|
5265
5278
|
if (!command) {
|
|
5266
5279
|
if (ignoreMissing) {
|
|
5267
5280
|
return {
|
|
@@ -5285,7 +5298,7 @@ var runImpl = async (options, execImpl, empty2) => {
|
|
|
5285
5298
|
manifest: pj
|
|
5286
5299
|
});
|
|
5287
5300
|
}
|
|
5288
|
-
const precommand = !options.ignorePrePost && scripts2[`pre${arg0}`];
|
|
5301
|
+
const precommand = !options.ignorePrePost && scripts2?.[`pre${arg0}`];
|
|
5289
5302
|
const pre = precommand ? await execImpl({
|
|
5290
5303
|
arg0: precommand,
|
|
5291
5304
|
...execArgs,
|
|
@@ -5316,7 +5329,7 @@ var runImpl = async (options, execImpl, empty2) => {
|
|
|
5316
5329
|
if (result.signal || result.status) {
|
|
5317
5330
|
return result;
|
|
5318
5331
|
}
|
|
5319
|
-
const postcommand = !options.ignorePrePost && scripts2[`post${arg0}`];
|
|
5332
|
+
const postcommand = !options.ignorePrePost && scripts2?.[`post${arg0}`];
|
|
5320
5333
|
if (!postcommand) return result;
|
|
5321
5334
|
const post = await execImpl({
|
|
5322
5335
|
arg0: postcommand,
|
|
@@ -10130,6 +10143,9 @@ var load4 = (options) => {
|
|
|
10130
10143
|
return graph;
|
|
10131
10144
|
};
|
|
10132
10145
|
|
|
10146
|
+
// ../../src/graph/src/reify/build.ts
|
|
10147
|
+
import { join as join2 } from "node:path";
|
|
10148
|
+
|
|
10133
10149
|
// ../../src/graph/src/non-empty-list.ts
|
|
10134
10150
|
var isNonEmptyList = (list) => !!list.length;
|
|
10135
10151
|
var nonEmptyList = (nodes) => isNonEmptyList(nodes) ? nodes : void 0;
|
|
@@ -10249,7 +10265,9 @@ var visit = async (packageJson, scurry, node, signal, _path) => {
|
|
|
10249
10265
|
preprepare,
|
|
10250
10266
|
postprepare
|
|
10251
10267
|
} = scripts2;
|
|
10252
|
-
const
|
|
10268
|
+
const hasBindingGyp = scurry.lstatSync(join2(node.resolvedLocation(scurry), "binding.gyp"))?.isFile() ?? false;
|
|
10269
|
+
const hasImplicitInstall = hasBindingGyp && !install2 && !preinstall;
|
|
10270
|
+
const runInstall = !!(install2 || preinstall || postinstall) || hasImplicitInstall;
|
|
10253
10271
|
if (runInstall) {
|
|
10254
10272
|
await run({
|
|
10255
10273
|
signal,
|
|
@@ -11829,6 +11847,19 @@ var endPeerPlacement = (peerContext, nextDeps, nextPeerDeps, graph, spec2, fromN
|
|
|
11829
11847
|
for (const nextDep of nextPeerDeps.values()) {
|
|
11830
11848
|
const { spec: spec3, type: type3 } = nextDep;
|
|
11831
11849
|
if (type3 === "peer" || type3 === "peerOptional") {
|
|
11850
|
+
const siblingEntry = queuedEntries.find(
|
|
11851
|
+
(e) => (e.target?.name ?? e.spec.final.name) === spec3.final.name
|
|
11852
|
+
);
|
|
11853
|
+
if (siblingEntry?.target && !node.edgesOut.has(spec3.final.name) && satisfies2(
|
|
11854
|
+
siblingEntry.target.id,
|
|
11855
|
+
spec3,
|
|
11856
|
+
fromNode.location,
|
|
11857
|
+
fromNode.projectRoot,
|
|
11858
|
+
graph.monorepo
|
|
11859
|
+
)) {
|
|
11860
|
+
graph.addEdge(type3, spec3, node, siblingEntry.target);
|
|
11861
|
+
continue;
|
|
11862
|
+
}
|
|
11832
11863
|
const entry = peerContext.get(spec3.final.name);
|
|
11833
11864
|
if (!node.edgesOut.has(spec3.final.name) && entry?.target && satisfies2(
|
|
11834
11865
|
entry.target.id,
|
|
@@ -11841,6 +11872,8 @@ var endPeerPlacement = (peerContext, nextDeps, nextPeerDeps, graph, spec2, fromN
|
|
|
11841
11872
|
entry.specs.add(spec3.final);
|
|
11842
11873
|
} else if (type3 === "peerOptional") {
|
|
11843
11874
|
graph.addEdge(type3, spec3, node);
|
|
11875
|
+
} else if (siblingEntry && siblingEntry.spec.bareSpec !== spec3.bareSpec) {
|
|
11876
|
+
nextDeps.push({ ...nextDep, spec: siblingEntry.spec });
|
|
11844
11877
|
} else {
|
|
11845
11878
|
nextDeps.push(nextDep);
|
|
11846
11879
|
}
|
|
@@ -12802,21 +12835,27 @@ var deleteEdges = (diff, scurry, remover) => {
|
|
|
12802
12835
|
};
|
|
12803
12836
|
|
|
12804
12837
|
// ../../src/graph/src/reify/check-needed-build.ts
|
|
12805
|
-
|
|
12838
|
+
import { join as join3 } from "node:path";
|
|
12839
|
+
var nodeNeedsBuild2 = (node, scurry) => {
|
|
12806
12840
|
if (node.built) return false;
|
|
12807
12841
|
const { manifest } = node;
|
|
12808
12842
|
if (!manifest) return false;
|
|
12809
12843
|
const { scripts: scripts2 = {} } = manifest;
|
|
12810
12844
|
const runInstall = !!(scripts2.install || scripts2.preinstall || scripts2.postinstall);
|
|
12811
12845
|
if (runInstall) return true;
|
|
12846
|
+
const hasBindingGyp = scurry.lstatSync(join3(node.resolvedLocation(scurry), "binding.gyp"))?.isFile() ?? false;
|
|
12847
|
+
if (hasBindingGyp && !scripts2.install && !scripts2.preinstall)
|
|
12848
|
+
return true;
|
|
12812
12849
|
const prepable = node.id.startsWith("git") || node.importer || !node.inVltStore();
|
|
12813
12850
|
const runPrepare = !!(scripts2.prepare || scripts2.preprepare || scripts2.postprepare) && prepable;
|
|
12814
12851
|
if (runPrepare) return true;
|
|
12815
12852
|
return false;
|
|
12816
12853
|
};
|
|
12817
12854
|
var checkNeededBuild = (options) => {
|
|
12818
|
-
const { diff } = options;
|
|
12819
|
-
const nodesToBuild = [...diff.nodes.add].filter(
|
|
12855
|
+
const { diff, scurry } = options;
|
|
12856
|
+
const nodesToBuild = [...diff.nodes.add].filter(
|
|
12857
|
+
(node) => nodeNeedsBuild2(node, scurry)
|
|
12858
|
+
);
|
|
12820
12859
|
for (const node of nodesToBuild) {
|
|
12821
12860
|
node.buildState = "needed";
|
|
12822
12861
|
}
|
|
@@ -13235,7 +13274,7 @@ var reify_ = async (options, diff, remover) => {
|
|
|
13235
13274
|
const edgeActions = addEdges(diff, scurry, remover);
|
|
13236
13275
|
if (edgeActions.length) await callLimit(edgeActions, { limit });
|
|
13237
13276
|
await internalHoist(diff.to, options, remover);
|
|
13238
|
-
checkNeededBuild({ diff });
|
|
13277
|
+
checkNeededBuild({ diff, scurry });
|
|
13239
13278
|
const allowScriptsNodes = await filterNodesByQuery2(
|
|
13240
13279
|
diff.to,
|
|
13241
13280
|
allowScripts
|
|
@@ -13700,4 +13739,4 @@ export {
|
|
|
13700
13739
|
cssesc/cssesc.js:
|
|
13701
13740
|
(*! https://mths.be/cssesc v3.0.0 by @mathias *)
|
|
13702
13741
|
*/
|
|
13703
|
-
//# sourceMappingURL=chunk-
|
|
13742
|
+
//# sourceMappingURL=chunk-5Y5FH5GW.js.map
|