@visulima/vis 6.7.0 → 7.0.0
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/CHANGELOG.md +68 -0
- package/README.md +31 -0
- package/bin/route.mjs +256 -0
- package/bin/vis +7 -0
- package/bin/vis.mjs +25 -31
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +16 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +88 -88
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +1 -1
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +1 -1
- package/dist/packem_chunks/handler65.js +1 -1
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +1 -1
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +25 -37
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +50 -25
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +6 -6
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +1 -1
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler79.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index7.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{advisories-CtqvyYvO.js → advisories-Vd2kwoSf.js} +1 -1
- package/dist/packem_shared/{affected-selection-Br8c1wPb.js → affected-selection-Dbbli-Ot.js} +1 -1
- package/dist/packem_shared/{ai-analysis-CouDH8gG.js → ai-analysis-DZEjy6lu.js} +1 -1
- package/dist/packem_shared/{ai-cache-Dw2Ob8Wr.js → ai-cache-Q7TuGULh.js} +1 -1
- package/dist/packem_shared/{ai-fix-C0xvBoNB.js → ai-fix-Cagw3I4D.js} +1 -1
- package/dist/packem_shared/{bin-By7Verav.js → bin-gxaewUwv.js} +1 -1
- package/dist/packem_shared/{build-scripts-B_9mXJug.js → build-scripts-B5sROJPn.js} +1 -1
- package/dist/packem_shared/{dependency-scan-C8znTO5f.js → dependency-scan-Cpk1Z6Wj.js} +1 -1
- package/dist/packem_shared/{detect-CyMwuNhc.js → detect-D8zxVYrU.js} +1 -1
- package/dist/packem_shared/{docker-CHjGzCjg.js → docker-2ZjBNNeE.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-Dz4eMiQ0.js → ecosystem-gate-BF9glH2Q.js} +1 -1
- package/dist/packem_shared/{env-UwvvHfsx.js → env-5cWSxQ96.js} +1 -1
- package/dist/packem_shared/{env-consistency-CTM_WJnR.js → env-consistency-DkH7lUU7.js} +1 -1
- package/dist/packem_shared/{failure-log-BH4ck8I4.js → failure-log-Dj9b94ax.js} +1 -1
- package/dist/packem_shared/github-workflow-command-Bn0MgB78.js +3 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-CYVM7sl3.js +1 -0
- package/dist/packem_shared/{index-BhcT3PpQ.js → index-Bu_rMPKl.js} +1 -1
- package/dist/packem_shared/{index-BhFtXNNB.js → index-Dn_z9DYf.js} +1 -1
- package/dist/packem_shared/{lifecycle-DNWes81J.js → lifecycle-BGTRxc9n.js} +1 -1
- package/dist/packem_shared/{manifests-B4s51bMW.js → manifests-C1FhhaNX.js} +1 -1
- package/dist/packem_shared/{min-release-age-P0ls4pAF.js → min-release-age-BbppxofB.js} +1 -1
- package/dist/packem_shared/{missing-package-json-BcKnQERZ.js → missing-package-json-DLTSyp4H.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-CGC9DH_l.js → multi-eco-lockfiles-CxwaJO4v.js} +1 -1
- package/dist/packem_shared/{native-config-sync-DnuL1Ck8.js → native-config-sync-Di-76fQc.js} +1 -1
- package/dist/packem_shared/{osv-CgEeaSxd.js → osv-DrEbiNXB.js} +1 -1
- package/dist/packem_shared/{package-version-CwpMpdja.js → package-version-lWlrF9Wk.js} +1 -1
- package/dist/packem_shared/{packument-CzXKq5Uj.js → packument-CW9GbXrT.js} +1 -1
- package/dist/packem_shared/{project-name-filter-DXEnW3Uz.js → project-name-filter-DQ323iaJ.js} +1 -1
- package/dist/packem_shared/{provenance-Bd0CbKIp.js → provenance-DnK4Z14A.js} +1 -1
- package/dist/packem_shared/publish-report-C-f7hkwx.js +1 -0
- package/dist/packem_shared/{registry-DBYHez15.js → registry-DqBIZZSL.js} +1 -1
- package/dist/packem_shared/{registry-keys-xPdrNru6.js → registry-keys-fVgmcPXl.js} +1 -1
- package/dist/packem_shared/{renderToString-DR0zDUjh-DYOVAAfx.js → renderToString-DR0zDUjh-C8HCAyYP.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BiX9lIh4.js → resolve-explicit-B9zDWjx_.js} +1 -1
- package/dist/packem_shared/{run-summary-utils-CkEtzBQD.js → run-summary-utils-H2tE2PUC.js} +1 -1
- package/dist/packem_shared/{runtime-check-Byzd_Jc9.js → runtime-check-B7ptIHX7.js} +1 -1
- package/dist/packem_shared/{s1ngularity-F2Tr5TBZ.js → s1ngularity-27TGL2H3.js} +1 -1
- package/dist/packem_shared/{scaffold-files-qM0oCb1Z.js → scaffold-files-BFWgtMR2.js} +1 -1
- package/dist/packem_shared/{scan-progress-e2fK9W0r.js → scan-progress-BwacnpFH.js} +1 -1
- package/dist/packem_shared/{selectors-BZF_PAg-.js → selectors-BisxDyYw.js} +1 -1
- package/dist/packem_shared/{signatures-FAEkrfxp.js → signatures-Bl3Y1qG3.js} +1 -1
- package/dist/packem_shared/{spinner-C14Fwarr.js → spinner-OBWz4yeR.js} +1 -1
- package/dist/packem_shared/{table-CXYb0Lek.js → table-BwL7to1g.js} +1 -1
- package/dist/packem_shared/{tabs-DbxzN8lr.js → tabs-Cr6uwTNJ.js} +1 -1
- package/dist/packem_shared/{toolchain-frFbcqqd.js → toolchain-DVLvBR49.js} +1 -1
- package/dist/packem_shared/{typosquats-CQMG0xHf.js → typosquats-DpcdyKGi.js} +1 -1
- package/dist/packem_shared/{use-measured-height-6ITmRvS-.js → use-measured-height-CVzcGyKB.js} +1 -1
- package/dist/packem_shared/{vis-update-app-_vu7O4s-.js → vis-update-app-0dbSUY-u.js} +1 -1
- package/dist/packem_shared/{vis-user-error-Dqv0he0c.js → vis-user-error-pMP1p7q1.js} +1 -1
- package/dist/packem_shared/watch-loop-ZjcOW5Qx.js +9 -0
- package/index.js +54 -54
- package/package.json +17 -13
- package/schemas/vis-config.schema.json +69 -0
- package/scripts/install-native.cjs +250 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-CoeGrbCO.js +0 -1
- package/dist/packem_shared/publish-report-DOXKGOAj.js +0 -3
- package/dist/packem_shared/watch-loop-CgxpnVYG.js +0 -11
|
@@ -1074,6 +1074,60 @@
|
|
|
1074
1074
|
"additionalProperties": false,
|
|
1075
1075
|
"description": "Where the ruleset comes from. Omit for the bundled gitleaks default."
|
|
1076
1076
|
},
|
|
1077
|
+
"overrides": {
|
|
1078
|
+
"type": "array",
|
|
1079
|
+
"items": {
|
|
1080
|
+
"type": "object",
|
|
1081
|
+
"properties": {
|
|
1082
|
+
"files": {
|
|
1083
|
+
"anyOf": [
|
|
1084
|
+
{
|
|
1085
|
+
"type": "string"
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
"type": "array",
|
|
1089
|
+
"items": {
|
|
1090
|
+
"type": "string"
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
],
|
|
1094
|
+
"description": "Gitignore-syntax globs relative to the workspace root, e.g. `*.env` or `packages/api/**`."
|
|
1095
|
+
},
|
|
1096
|
+
"rules": {
|
|
1097
|
+
"type": "object",
|
|
1098
|
+
"properties": {
|
|
1099
|
+
"enable": {
|
|
1100
|
+
"type": "array",
|
|
1101
|
+
"items": {
|
|
1102
|
+
"type": "string"
|
|
1103
|
+
},
|
|
1104
|
+
"description": "Enable opt-in rules for matching files only."
|
|
1105
|
+
},
|
|
1106
|
+
"exclude": {
|
|
1107
|
+
"type": "array",
|
|
1108
|
+
"items": {
|
|
1109
|
+
"type": "string"
|
|
1110
|
+
},
|
|
1111
|
+
"description": "Drop these rules for matching files."
|
|
1112
|
+
},
|
|
1113
|
+
"include": {
|
|
1114
|
+
"type": "array",
|
|
1115
|
+
"items": {
|
|
1116
|
+
"type": "string"
|
|
1117
|
+
},
|
|
1118
|
+
"description": "Restrict matching files to these rules."
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
"additionalProperties": false
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
"required": [
|
|
1125
|
+
"files"
|
|
1126
|
+
],
|
|
1127
|
+
"additionalProperties": false
|
|
1128
|
+
},
|
|
1129
|
+
"description": "File-specific rule filters, applied after the global `rules` filters."
|
|
1130
|
+
},
|
|
1077
1131
|
"redact": {
|
|
1078
1132
|
"type": "boolean",
|
|
1079
1133
|
"description": "Redact secret values in findings."
|
|
@@ -1099,6 +1153,21 @@
|
|
|
1099
1153
|
"additionalProperties": false,
|
|
1100
1154
|
"description": "Rule-id filters applied after scanning."
|
|
1101
1155
|
},
|
|
1156
|
+
"secretlintIgnore": {
|
|
1157
|
+
"anyOf": [
|
|
1158
|
+
{
|
|
1159
|
+
"type": "array",
|
|
1160
|
+
"items": {
|
|
1161
|
+
"type": "string"
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
"type": "boolean",
|
|
1166
|
+
"const": false
|
|
1167
|
+
}
|
|
1168
|
+
],
|
|
1169
|
+
"description": "`.secretlintignore` paths, or `false` to disable auto-discovery."
|
|
1170
|
+
},
|
|
1102
1171
|
"walk": {
|
|
1103
1172
|
"type": "object",
|
|
1104
1173
|
"properties": {
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// `preinstall` hook of @visulima/vis. Package managers create the `vis` command
|
|
4
|
+
// from `bin/vis`; this script replaces that file with the platform's native
|
|
5
|
+
// executable so the shim execs it directly and no Node process is started.
|
|
6
|
+
//
|
|
7
|
+
// It must never fail an install: every problem leaves `bin/vis` as the Node
|
|
8
|
+
// launcher (`bin/vis` as published), which resolves the same binary at runtime
|
|
9
|
+
// and still works, just with a Node start-up cost. It is CommonJS and uses the
|
|
10
|
+
// standard library only because it runs before anything is installed.
|
|
11
|
+
//
|
|
12
|
+
// Skipped (launcher stays) when:
|
|
13
|
+
// - the package is not under a node_modules directory (a checkout of the repo),
|
|
14
|
+
// - the platform has no binary, or `VIS_SKIP_NATIVE_LINK` is set,
|
|
15
|
+
// - Windows: the generated `.cmd` shim cannot exec an extensionless `bin/vis`,
|
|
16
|
+
// - the platform package is missing (`--omit=optional`) or its binary does not run,
|
|
17
|
+
// - pnpm may already have written a shim that starts Node (see `pnpmShimMayStartNode`).
|
|
18
|
+
|
|
19
|
+
const { spawnSync } = require("node:child_process");
|
|
20
|
+
const { chmodSync, copyFileSync, existsSync, linkSync, readFileSync, realpathSync, renameSync, rmSync } = require("node:fs");
|
|
21
|
+
const { basename, dirname, join, relative, sep } = require("node:path");
|
|
22
|
+
|
|
23
|
+
const packageRoot = join(__dirname, "..");
|
|
24
|
+
const target = join(packageRoot, "bin", "vis");
|
|
25
|
+
|
|
26
|
+
const isMusl = () => {
|
|
27
|
+
const report = typeof process.report?.getReport === "function" ? process.report.getReport() : undefined;
|
|
28
|
+
|
|
29
|
+
if (report && Array.isArray(report.sharedObjects)) {
|
|
30
|
+
return report.sharedObjects.some((object) => object.includes("libc.musl-") || object.includes("ld-musl-"));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return report ? !report.header?.glibcVersionRuntime : false;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Same platform -> package slug table as `bin/resolve-binary.mjs`.
|
|
37
|
+
const slug = () => {
|
|
38
|
+
const { arch, platform } = process;
|
|
39
|
+
|
|
40
|
+
if (platform === "linux" && (arch === "arm64" || arch === "x64")) {
|
|
41
|
+
return `linux-${arch}-${isMusl() ? "musl" : "gnu"}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (platform === "darwin" && (arch === "arm64" || arch === "x64")) {
|
|
45
|
+
return `darwin-${arch}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Entries of the `ignoredBuilds` / `pendingBuilds` lists in `.modules.yaml`, either
|
|
52
|
+
// block (`- '@scope/name@1.0.0'`) or flow (`[a, b]`) style. Hand-parsed because this
|
|
53
|
+
// script runs before anything is installed.
|
|
54
|
+
const skippedBuilds = (yaml) => {
|
|
55
|
+
const entries = [];
|
|
56
|
+
let inList = false;
|
|
57
|
+
|
|
58
|
+
for (const line of yaml.split(/\r?\n/u)) {
|
|
59
|
+
const key = /^(\w+):\s*(.*)$/u.exec(line);
|
|
60
|
+
|
|
61
|
+
if (key) {
|
|
62
|
+
inList = key[1] === "ignoredBuilds" || key[1] === "pendingBuilds";
|
|
63
|
+
|
|
64
|
+
if (inList) {
|
|
65
|
+
entries.push(...key[2].replace(/^\[|\]$/gu, "").split(","));
|
|
66
|
+
}
|
|
67
|
+
} else if (inList) {
|
|
68
|
+
entries.push(line.replace(/^\s*-/u, ""));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return entries.map((entry) => entry.trim().replace(/^['"]|['"]$/gu, "")).filter(Boolean);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// `@visulima/vis@<this version>`, optionally followed by pnpm's peer suffix.
|
|
76
|
+
const isThisPackage = (entry, version) => {
|
|
77
|
+
const prefix = `@visulima/vis@${version}`;
|
|
78
|
+
|
|
79
|
+
return entry.startsWith(prefix) && !/^[\w.-]/u.test(entry.slice(prefix.length));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// The project's `node_modules`, the directory holding pnpm's `.bin` and `.modules.yaml`. Inside pnpm's
|
|
83
|
+
// virtual store that is the directory above `.pnpm`; otherwise the nearest `node_modules` ancestor.
|
|
84
|
+
const projectModulesDirectory = () => {
|
|
85
|
+
let directory = packageRoot;
|
|
86
|
+
|
|
87
|
+
while (dirname(directory) !== directory) {
|
|
88
|
+
if (basename(directory) === ".pnpm") {
|
|
89
|
+
return dirname(directory);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
directory = dirname(directory);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
directory = packageRoot;
|
|
96
|
+
|
|
97
|
+
while (dirname(directory) !== directory) {
|
|
98
|
+
if (basename(directory) === "node_modules") {
|
|
99
|
+
return directory;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
directory = dirname(directory);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return undefined;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Directories whose `.bin` may hold the shim for this package: the one the virtual store sits in,
|
|
109
|
+
// and the one of the project pnpm was run from (`INIT_CWD`), which is a workspace member's own
|
|
110
|
+
// `node_modules` when that member depends on this package or the store is not under `node_modules`.
|
|
111
|
+
const shimModulesDirectories = () => {
|
|
112
|
+
const directories = [projectModulesDirectory()];
|
|
113
|
+
|
|
114
|
+
if (process.env.INIT_CWD) {
|
|
115
|
+
directories.push(join(process.env.INIT_CWD, "node_modules"));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return [...new Set(directories.filter((directory) => directory !== undefined))];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// Whether the shim in `modules/.bin` was written for this very package directory, starts Node, and
|
|
122
|
+
// predates this run. pnpm writes `exec node "$basedir/<relative path to bin/vis>"`, so the path names the
|
|
123
|
+
// package directory (version included): the shim of an earlier version, or one that execs the binary
|
|
124
|
+
// directly, leaves the launcher free to be replaced. pnpm 12 also writes the shim of a first install
|
|
125
|
+
// before it runs this script, and rewrites it afterwards; `.modules.yaml` is only written once an
|
|
126
|
+
// install has finished, so a shim without one belongs to the current run. A shim that cannot be read
|
|
127
|
+
// cannot be ruled out.
|
|
128
|
+
const shimStartsNodeForThisPackage = (modules) => {
|
|
129
|
+
const shim = join(modules, ".bin", "vis");
|
|
130
|
+
|
|
131
|
+
if (!existsSync(shim) || !existsSync(join(modules, ".modules.yaml"))) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const text = readFileSync(shim, "utf8");
|
|
137
|
+
const launcher = relative(realpathSync(dirname(shim)), target).split(sep).join("/");
|
|
138
|
+
|
|
139
|
+
return text.includes(launcher) && /\bexec\s+(?:node|"\$basedir\/node")\s/u.test(text);
|
|
140
|
+
} catch {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// pnpm writes the `.bin` shim from the shebang of `bin/vis`, which is `node` while the launcher is in
|
|
146
|
+
// place. A first install rewrites the shim after this script ran, but a later run does not: `pnpm
|
|
147
|
+
// approve-builds` / `pnpm rebuild`, or an install on top of an earlier one that skipped the script.
|
|
148
|
+
// Replacing `bin/vis` then would leave `node <native binary>`, which crashes, so keep the launcher,
|
|
149
|
+
// which works with either shim. Those two commands are recognised by `npm_command` and, because pnpm
|
|
150
|
+
// does not guarantee it, by a shim for this package directory left by a finished install. An upgrade
|
|
151
|
+
// finds the shim of the previous version, which names another directory, and goes native.
|
|
152
|
+
const pnpmShimMayStartNode = () => {
|
|
153
|
+
if (!(process.env.npm_config_user_agent || "").startsWith("pnpm/")) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (process.env.npm_command === "rebuild" || process.env.npm_command === "approve-builds") {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const directories = shimModulesDirectories();
|
|
162
|
+
|
|
163
|
+
if (directories.some(shimStartsNodeForThisPackage)) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// pnpm lists packages whose scripts it skipped (`ignoredBuilds`, `pendingBuilds`) in
|
|
168
|
+
// `node_modules/.modules.yaml`, next to the `.pnpm` virtual store.
|
|
169
|
+
let version;
|
|
170
|
+
|
|
171
|
+
try {
|
|
172
|
+
({ version } = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")));
|
|
173
|
+
} catch {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return directories.some((modules) => {
|
|
178
|
+
try {
|
|
179
|
+
return skippedBuilds(readFileSync(join(modules, ".modules.yaml"), "utf8")).some((entry) => isThisPackage(entry, version));
|
|
180
|
+
} catch {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const main = () => {
|
|
187
|
+
if (process.env.VIS_SKIP_NATIVE_LINK || process.platform === "win32" || !packageRoot.includes(`${sep}node_modules${sep}`)) {
|
|
188
|
+
return "skipped";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (pnpmShimMayStartNode()) {
|
|
192
|
+
return "pnpm already linked a shim that starts Node; remove node_modules and reinstall to use the native binary";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const name = slug();
|
|
196
|
+
|
|
197
|
+
if (name === undefined) {
|
|
198
|
+
return "unsupported platform";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
let binary;
|
|
202
|
+
|
|
203
|
+
try {
|
|
204
|
+
binary = require.resolve(`@visulima/vis-binding-${name}/vis-native-cli`, { paths: [packageRoot] });
|
|
205
|
+
} catch {
|
|
206
|
+
return `@visulima/vis-binding-${name} is not installed`;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// A wrong-architecture or truncated binary must not replace the working launcher.
|
|
210
|
+
const probe = spawnSync(binary, ["--version"], { stdio: "ignore", timeout: 15_000 });
|
|
211
|
+
|
|
212
|
+
if (probe.status !== 0) {
|
|
213
|
+
return "the platform binary does not run";
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Build the replacement next to the launcher and rename it over `bin/vis`: the swap is
|
|
217
|
+
// atomic, and it replaces the directory entry rather than writing through it (a package
|
|
218
|
+
// manager may have hard-linked `bin/vis` from its content store).
|
|
219
|
+
const temporary = `${target}.${process.pid}.tmp`;
|
|
220
|
+
|
|
221
|
+
try {
|
|
222
|
+
rmSync(temporary, { force: true });
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
linkSync(binary, temporary);
|
|
226
|
+
} catch {
|
|
227
|
+
// Cross-device or a file system without hard links.
|
|
228
|
+
copyFileSync(binary, temporary);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
chmodSync(temporary, 0o755);
|
|
232
|
+
renameSync(temporary, target);
|
|
233
|
+
} catch (error) {
|
|
234
|
+
rmSync(temporary, { force: true });
|
|
235
|
+
|
|
236
|
+
return `could not replace bin/vis (${error && error.message}); it was left unchanged`;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return "linked";
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
try {
|
|
243
|
+
const outcome = main();
|
|
244
|
+
|
|
245
|
+
if (outcome !== "linked" && outcome !== "skipped" && process.env.npm_config_loglevel !== "silent") {
|
|
246
|
+
console.warn(`vis: using the Node launcher (${outcome}); commands start slower.`);
|
|
247
|
+
}
|
|
248
|
+
} catch (error) {
|
|
249
|
+
console.warn(`vis: could not link the native binary (${error && error.message}); using the Node launcher.`);
|
|
250
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as t}from"./registry-DBYHez15.js";const s=async(a,o)=>await t(a,o);export{s as l};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const s=(r,n)=>{process.env.GITHUB_ACTIONS==="true"&&process.stdout.write(`::${r}::${n.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
2
|
-
`,"%0A")}
|
|
3
|
-
`)},i=(r,n)=>{r.warn(n),s("warning",n)},o=(r,n)=>{r.error(n),s("error",n)},t=(r,n,a)=>{for(const e of n.published)r.info(` [published] ${e.name}@${e.version} (dist-tag ${a})`);for(const e of n.skipped)e.reason.startsWith("stage-")?(r.warn(` [stage] ${e.name} (${e.reason} — re-run \`vis release publish\` once approved)`),s("warning",`${e.name}: ${e.reason} — re-run \`vis release publish\` once approved`)):r.info(` [skipped] ${e.name} (${e.reason})`);for(const e of n.failed)r.error(` [failed] ${e.name}: ${e.reason}`),s("error",`${e.name}: ${e.reason}`);r.info(""),r.info(`Published: ${n.published.length} | Skipped: ${n.skipped.length} | Failed: ${n.failed.length}`),n.tags.length>0&&r.info(`Tags created: ${n.tags.length}${n.tagsPushed?" (pushed)":" (NOT pushed — re-run with --resume to retry)"}`)},p=(r,n)=>{const a=[...new Set(n)];if(a.length!==0){r.warn(`${a.length} warning(s):`);for(const e of a)r.warn(` - ${e}`),s("warning",e)}};export{t as a,o as b,i as l,p as r};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{createRequire as q}from"node:module";import{e as m,z as U,v as S,U as J,m as z}from"./index-0dnGN3GP.js";import{v as A}from"./registry-DBYHez15.js";import{d as M,f as E}from"./detect-CyMwuNhc.js";import{y as K}from"./isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{h as ne}from"./env-UwvvHfsx.js";import{s as se}from"./watch-C-9-PD2m.js";let B;const V=e=>(B??=q(import.meta.url))(e),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,n]=y.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return y.getBuiltinModule(e)}return V(e)},{createHash:v}=x("node:crypto"),{spawnSync:G,spawn:H}=x("node:child_process"),{openSync:Y,writeSync:Q,closeSync:X,statSync:Z,readFileSync:O,mkdirSync:ee,writeFileSync:te}=x("node:fs"),{pathToFileURL:re}=x("node:url"),{availableParallelism:F}=x("node:os"),oe={error:"error",info:"info",information:"info",warning:"warning"},Ye={argsCheck:(e,t)=>k(e,t,!1),argsFix:(e,t)=>k(e,t,!0),bin:()=>["pnpm","exec","biome"],cacheKey:(e,t)=>{const n=["biome",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return v("sha256").update(n.join("|")).digest("hex").slice(0,16)},detect:(e,t)=>{const n=M(t,A.biome.packageNames[0]),r=E(e,A.biome.configFiles);if(!(!n&&!r))return{adapter:"biome",configFile:r,declared:!!n,declaredVersion:n,root:e}},extensions:["astro","cjs","css","cts","js","json","jsonc","jsx","mjs","mts","svelte","ts","tsx","vue"],id:"biome",kind:"both",parse:(e,t)=>{if(!e.stdout.trim())return[];let n;try{n=JSON.parse(e.stdout)}catch{return[{adapter:"biome",file:t.root,fixable:!1,message:`biome output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const r=[];for(const o of n.diagnostics??[]){const s=o.location?.start,i=o.location?.end,c=ie(t.root,o.location?.path),u=o.category??"",a=u==="format"||u.startsWith("format/");r.push({adapter:"biome",column:s?.column&&s.column>0?s.column:void 0,endColumn:i?.column&&i.column>0?i.column:void 0,endLine:i?.line&&i.line>0?i.line:void 0,file:c,fixable:!0,line:s?.line&&s.line>0?s.line:void 0,message:a?"Code style issues would be auto-fixed":o.message??"",ruleId:u||void 0,severity:oe[o.severity??""]??"warning"})}return r}},k=(e,t,n)=>{const r=["check","--reporter=json"];return n&&r.push("--write"),typeof t.maxWarnings=="number"&&r.push(`--max-diagnostics=${String(t.maxWarnings)}`),t.extraArgs?.length&&r.push(...t.extraArgs),r.push(...e),r},ie=(e,t)=>{const n=typeof t=="string"?t:t?.file;return n?n.startsWith("/")||/^[a-z]:[\\/]/i.test(n)?n:m(e,n):e},j="pyproject.toml",ce=/^\[tool\.ruff(?:\.[\w-]+)*\]\s*$/m,ae=/^Would reformat:?\s+(.+)$/,le=e=>{const t=m(e,j);if(!K(t))return!1;try{const n=U(t);return ce.test(n)}catch{return!1}},N=e=>(t,n)=>{const r=A.ruff.packageNames.map(c=>M(n,c)).find(c=>c!==void 0),o=E(t,A.ruff.configFiles),s=o?void 0:le(t)?m(t,j):void 0,i=o??s;if(!(!r&&!i))return{adapter:e,configFile:i,declared:!!r,declaredVersion:r,root:t}},ue=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),P=(e,t)=>e?ue(e)?e:m(t,e):t,fe=e=>ae.exec(e)?.[1]?.trim(),Qe={argsCheck:(e,t)=>I(e,t,!1),argsFix:(e,t)=>I(e,t,!0),bin:()=>["ruff","check"],cacheKey:(e,t)=>{const n=["ruff-check",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return v("sha256").update(n.join("|")).digest("hex").slice(0,16)},detect:N("ruff-check"),extensions:["py","pyi"],id:"ruff-check",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let n;try{n=JSON.parse(e.stdout)}catch{return[{adapter:"ruff-check",file:t.root,fixable:!1,message:`ruff check output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const r=[];for(const o of n){const s=o.location,i=o.end_location;r.push({adapter:"ruff-check",column:s?.column,endColumn:i?.column,endLine:i?.row,file:P(o.filename,t.root),fixable:!!o.fix,line:s?.row,message:o.message??"",ruleId:o.code,severity:"warning"})}return r}},Xe={argsCheck:(e,t)=>R(e,t,!1),argsFix:(e,t)=>R(e,t,!0),bin:()=>["ruff","format"],cacheKey:(e,t)=>{const n=["ruff-fmt",e.declaredVersion??"unknown",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return v("sha256").update(n.join("|")).digest("hex").slice(0,16)},detect:N("ruff-fmt"),extensions:["py","pyi"],id:"ruff-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const n=[],r=new Set;for(const o of e.stdout.split(/\r?\n/)){const s=fe(o);!s||r.has(s)||(r.add(s),n.push({adapter:"ruff-fmt",file:P(s,t.root),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return n}},I=(e,t,n)=>{const r=["--output-format=json"];return n&&r.push("--fix"),t.quiet&&r.push("--quiet"),t.extraArgs?.length&&r.push(...t.extraArgs),r.push(...e),r},R=(e,t,n)=>{const r=[];return n||r.push("--check"),t.quiet&&r.push("--quiet"),t.extraArgs?.length&&r.push(...t.extraArgs),r.push(...e),r},Ze=(e,t)=>{const n=w(e,["diff","--name-only","--diff-filter=ACMR","-z",`${t}...HEAD`]);if(n===void 0)return;const r=w(e,["diff","--name-only","--diff-filter=ACMR","-z"]),o=w(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]),s=w(e,["ls-files","--others","--exclude-standard","-z"]),i=new Set;for(const c of[n,r??"",o??"",s??""])for(const u of c.split("\0"))u.length!==0&&i.add(S(u)?u:m(e,u));return[...i].sort()},et=e=>{const t=w(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]);if(t===void 0)return;const n=new Set;for(const r of t.split("\0"))r.length!==0&&n.add(S(r)?r:m(e,r));return[...n].sort()},w=(e,t)=>{const n=G("git",[...t],{cwd:e,encoding:"utf8",timeout:1e4});if(n.status===0)return n.stdout},tt=(e,t)=>{const n=new Set(t.map(s=>s.toLowerCase())),r=[],o=new Set;for(const s of e){const i=s.lastIndexOf(".");if(i===-1||i===s.length-1)continue;const c=s.slice(i+1).toLowerCase();n.has(c)&&(o.has(s)||(o.add(s),r.push(s)))}return r},de=new Set(["-","stdout"]),T=e=>({close:()=>{},write:t=>{e.write(t)}}),pe=e=>{ne(z(e));const t=Y(e,"w");let n=[];return{close:()=>{n.length>0&&(Q(t,n.join("")),n=[]),X(t)},write:r=>{n.push(r)}}},nt=e=>{const{cwd:t,target:n}=e;if(n===void 0||de.has(n))return T(process.stdout);if(n==="stderr")return T(process.stderr);const r=S(n)?n:J(t,n);return pe(r)},C=["oxlint","oxfmt","biome","eslint","dprint","prettier","stylelint","ruff-check","ruff-fmt","markdownlint","shellcheck","typecheck"],rt=(e,t)=>{const n=new Map(e.map(i=>[i.id,i])),r=[],o=new Set,s=t&&t.length>0?t:C;for(const i of s){const c=n.get(i);c&&!o.has(i)&&(r.push(c),o.add(i))}if(t&&t.length>0)for(const i of C){const c=n.get(i);c&&!o.has(i)&&(r.push(c),o.add(i))}for(const i of e)o.has(i.id)||(r.push(i),o.add(i.id));return r},st=(e,t,n)=>{const r=[];for(const o of t){const s=e.get(o.id);s&&me(o.kind,n)&&r.push({adapter:o,presence:s})}return r},me=(e,t)=>e===t||e==="both",ot=(e,t,n={})=>{const r=new Map;for(const o of e){const s=he(o),i=ge(s,t,n);if(!i)continue;const c=r.get(i);c?c.push(o):r.set(i,[o])}return r},he=e=>{const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()},ge=(e,t,n)=>{const r=n[e];if(r&&t.some(o=>o.adapter.id===r))return r;for(const{adapter:o}of t)if(o.extensions.includes(e))return o.id},it=(e,t,n)=>{const r=new Set(C),o=new Set([...n?.order??[],...Object.keys(n?.adapters??{})]);for(const s of o)r.has(s)||e.warn(`vis.config ${t}: unknown adapter "${s}" is ignored.`)},ye=e=>e==="error"?"error":e==="warning"?"warning":"notice",D=e=>e.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
2
|
-
`,"%0A"),_=e=>D(e).replaceAll(",","%2C").replaceAll(":","%3A").replaceAll("=","%3D"),we=(e,t)=>t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e,xe=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),ve=(e,t)=>{const n=ye(e.severity),r=we(e.file,t),o=e.ruleId?`${e.adapter}(${e.ruleId})`:e.adapter,s=[`file=${_(r)}`];return e.line!==void 0&&s.push(`line=${String(e.line)}`),e.endLine!==void 0&&s.push(`endLine=${String(e.endLine)}`),e.column!==void 0&&s.push(`col=${String(e.column)}`),e.endColumn!==void 0&&s.push(`endColumn=${String(e.endColumn)}`),s.push(`title=${_(o)}`),`::${n} ${s.join(",")}::${D(e.message)}
|
|
3
|
-
`},ct=e=>e.runs.flatMap(n=>[...n.findings]).sort(xe).map(n=>ve(n,e.workspaceRoot)).join(""),g=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),Se=e=>`<![CDATA[${e.replaceAll("]]>","]]]]><![CDATA[>")}]]>`,Ae=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),$e=e=>e==="error"?"error":e==="warning"?"warning":"info",Ce=(e,t)=>{let{file:n}=e;return t&&e.file.startsWith(`${t}/`)&&(n=e.file.slice(t.length+1)),e.line===void 0?n:e.column===void 0?`${n}:${String(e.line)}`:`${n}:${String(e.line)}:${String(e.column)}`},Fe=(e,t,n)=>{const r=Ce(e,n),o=$e(e.severity),s=e.ruleId?`[${e.ruleId}] ${e.message}`:e.message;return[` <testcase classname="${g(t)}" name="${g(r)}">`,` <failure type="${g(o)}" message="${g(s)}">${Se(e.message)}</failure>`," </testcase>",""].join(`
|
|
4
|
-
`)},ke=(e,t,n)=>{const r=[...e.findings].sort(Ae),o=r.filter(f=>f.severity==="error").length,s=r.filter(f=>f.severity==="warning").length,i=r.length,c=(e.durationMs/1e3).toFixed(3),u=r.map(f=>Fe(f,e.adapter,n)).join("");return` <testsuite ${[`name="${g(e.adapter)}"`,`tests="${String(i)}"`,`failures="${String(o)}"`,'errors="0"',`skipped="${String(s)}"`,`time="${c}"`,`timestamp="${t}"`].join(" ")}>
|
|
5
|
-
${u} </testsuite>
|
|
6
|
-
`},at=e=>{const t=(e.now??new Date).toISOString(),n=e.suiteName??"vis-lint-fmt",r=e.runs.map(a=>ke(a,t,e.workspaceRoot)).join(""),o=e.runs.reduce((a,f)=>a+f.findings.length,0),s=e.runs.reduce((a,f)=>a+f.findings.filter(l=>l.severity==="error").length,0),i=e.runs.reduce((a,f)=>a+f.findings.filter(l=>l.severity==="warning").length,0),c=(e.runs.reduce((a,f)=>a+f.durationMs,0)/1e3).toFixed(3);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
7
|
-
<testsuites ${[`name="${g(n)}"`,`tests="${String(o)}"`,`failures="${String(s)}"`,'errors="0"',`skipped="${String(i)}"`,`time="${c}"`].join(" ")}>
|
|
8
|
-
${r}</testsuites>
|
|
9
|
-
`},Ie="2.1.0",Re="https://json.schemastore.org/sarif-2.1.0.json",Te=e=>e==="error"?"error":e==="warning"?"warning":"note",_e=(e,t)=>t&&e.startsWith(`${t}/`)?{uri:e.slice(t.length+1),uriBaseId:"SRCROOT"}:{uri:e},be=e=>{const{href:t}=re(e);return t.endsWith("/")?t:`${t}/`},Le=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),Me=e=>{const t=new Map;for(const n of e)n.ruleId&&(t.has(n.ruleId)||t.set(n.ruleId,{id:n.ruleId,name:n.ruleId}));return[...t.values()]},Ee=(e,t)=>{const{uri:n,uriBaseId:r}=_e(e.file,t),o={artifactLocation:r?{uri:n,uriBaseId:r}:{uri:n}};if(e.line!==void 0){const i={startLine:e.line};e.column!==void 0&&(i.startColumn=e.column),e.endLine!==void 0&&(i.endLine=e.endLine),e.endColumn!==void 0&&(i.endColumn=e.endColumn),o.region=i}const s={level:Te(e.severity),locations:[{physicalLocation:o}],message:{text:e.message}};return e.ruleId&&(s.ruleId=e.ruleId),s},Oe=(e,t)=>{const n=[...e.findings].sort(Le),r=Me(n),o={name:e.adapter,rules:r};e.presence?.declaredVersion&&(o.version=e.presence.declaredVersion);const s={results:n.map(i=>Ee(i,t)),tool:{driver:o}};return t&&(s.originalUriBaseIds={SRCROOT:{uri:be(t)}}),s},lt=e=>{const t={$schema:Re,runs:e.runs.map(n=>Oe(n,e.workspaceRoot)),version:Ie};return`${JSON.stringify(t,void 0,2)}
|
|
10
|
-
`},b={error:3,info:1,warning:2},ut=e=>{const t=[],n=[];let r,o=!1;for(const s of e){n.push({adapter:s.adapter,durationMs:s.durationMs,exitCode:s.exitCode,findingCount:s.findings.length}),s.exitCode!==0&&s.exitCode!==null&&s.findings.length===0&&(o=!0);for(const i of s.findings)t.push(i),(!r||b[i.severity]>b[r])&&(r=i.severity)}return{findings:t,hadProcessFailure:o,maxSeverity:r,runs:n}},ft=e=>{const t=new Map;for(const n of e){const r=t.get(n.file);r?r.push(n):t.set(n.file,[n])}return t},dt=e=>e.hadProcessFailure||e.maxSeverity==="error"?1:0,je=(e,t)=>{if(t==="fix"||process.env.VIS_NO_CACHE==="1"||e.length===0)return!1;for(const n of e)if(n==="."||n==="./"||n==="..")return!1;return!0},Ne=e=>{try{const t=O(e);return v("sha256").update(t).digest("hex")}catch{return}},Pe=(e,t,n,r,o)=>{const s=e.cacheKey(t,r),i=[];for(const u of[...n].sort()){const a=S(u)?u:m(t.root,u);try{Z(a)}catch{return}const f=Ne(a);if(!f)return;i.push({hash:f,path:a})}const c=v("sha256");c.update(e.id),c.update("\0"),c.update(s),c.update("\0"),c.update(o);for(const u of i)c.update("\0"),c.update(u.path),c.update("\0"),c.update(u.hash);return{fileHashes:i,key:c.digest("hex")}},W=(e,t)=>m(e,"lint-fmt",t),De=(e,t,n)=>{const r=m(W(e,t.id),`${n}.json`);try{const o=O(r,"utf8"),s=JSON.parse(o);return s.schema!==1?void 0:s}catch{return}},We=(e,t,n,r,o)=>{const s=W(e,t.id),i={fileHashes:o,result:r,savedAt:Date.now(),schema:1};try{ee(s,{recursive:!0}),te(m(s,`${n}.json`),JSON.stringify(i))}catch{}},L=async(e,t,n,r,o)=>{const s=e.bin(t),i=[...s.slice(1),...o==="fix"?e.argsFix(n,r):e.argsCheck(n,r)];return new Promise(c=>{const u=Date.now(),a=H(s[0],i,{cwd:t.root}),f=[],l=[];let h=!1;const p=setTimeout(()=>{h=!0,a.kill("SIGKILL")},6e4);a.stdout.on("data",d=>f.push(d)),a.stderr.on("data",d=>l.push(d)),a.on("error",d=>{clearTimeout(p),c({durationMs:Date.now()-u,exitCode:null,stderr:d.message,stdout:""})}),a.on("close",d=>{clearTimeout(p),c({durationMs:Date.now()-u,exitCode:h?null:d,stderr:Buffer.concat(l).toString("utf8"),stdout:Buffer.concat(f).toString("utf8")})})})},pt=async(e,t,n,r=F())=>{if(e.length===0)return[];const{cacheRoot:o,concurrency:s}=typeof r=="number"?{concurrency:r}:{cacheRoot:r.cacheRoot,concurrency:r.concurrency??F()},i=async l=>{const h=l.options??t;if(o&&je(l.files,n)){const p=Pe(l.adapter,l.presence,l.files,h,n);if(p){const d=De(o,l.adapter,p.key);if(d)return d.result;const $=await L(l.adapter,l.presence,l.files,h,n);return $.exitCode!==null&&We(o,l.adapter,p.key,$,p.fileHashes),$}}return L(l.adapter,l.presence,l.files,h,n)};if(process.env.VIS_LINT_FMT_SERIAL==="1"){const l=[];for(const h of e)l.push(await i(h));return l}const c=Math.max(1,Math.min(s,e.length)),u=Array.from({length:e.length});let a=0;const f=async()=>{for(;;){const l=a;if(a+=1,l>=e.length)return;u[l]=await i(e[l])}};return await Promise.all(Array.from({length:c},()=>f())),u},qe=e=>{const t=new Set;for(const n of e)t.add(n.toLowerCase());return t},Be=(e,t)=>{const n=e.lastIndexOf(".");return n===-1||n===e.length-1?!1:t.has(e.slice(n+1).toLowerCase())},mt=async e=>{const{extensions:t,initialFiles:n,label:r,log:o,runCycle:s,workspaceRoot:i}=e,c=o??(p=>{process.stdout.write(`${p}
|
|
11
|
-
`)}),u=qe(t);await s(n),c(`▸ ${r}: watching workspace — press Ctrl-C to exit`);let a=new Set,f=!1;const l=async()=>{for(;a.size>0;){const p=[...a];a=new Set;try{await s(p)}catch(d){c(`✗ ${r}: watch cycle failed — ${d.message}`)}}},h=se({debounceMs:200,filter:p=>Be(p,u),onChange:async p=>{for(const d of p)a.add(S(d)?d:m(i,d));if(!f){f=!0;try{await l()}finally{f=!1}}},paths:[i]});await new Promise(p=>{const d=()=>{h.close(),process.off("SIGINT",d),process.off("SIGTERM",d),p()};process.once("SIGINT",d),process.once("SIGTERM",d)})};export{st as a,mt as b,Ze as c,Ye as d,Xe as e,ot as f,pt as g,ut as h,nt as i,lt as j,at as k,ct as l,dt as m,ft as n,Qe as o,tt as p,rt as r,et as s,it as w};
|