@wrongstack/tools 0.277.1 → 0.280.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/dist/bash.js +2 -2
- package/dist/bash.js.map +1 -1
- package/dist/builtin.js +314 -15
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.js +12 -11
- package/dist/codebase-index/index.js.map +1 -1
- package/dist/codebase-index/worker.js +12 -11
- package/dist/codebase-index/worker.js.map +1 -1
- package/dist/exec-Ca3fnpUh.d.ts +121 -0
- package/dist/exec.d.ts +2 -39
- package/dist/exec.js +322 -11
- package/dist/exec.js.map +1 -1
- package/dist/index.d.ts +46 -3
- package/dist/index.js +629 -153
- package/dist/index.js.map +1 -1
- package/dist/install.js.map +1 -1
- package/dist/json.js +0 -1
- package/dist/json.js.map +1 -1
- package/dist/logs.js.map +1 -1
- package/dist/pack.js +314 -15
- package/dist/pack.js.map +1 -1
- package/dist/scaffold.js.map +1 -1
- package/dist/tool-icons.js +6 -6
- package/dist/tool-icons.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parentPort } from 'node:worker_threads';
|
|
2
2
|
import { expectDefined, resolveWstackPaths, compileGlob, truncate } from '@wrongstack/core';
|
|
3
|
-
import * as
|
|
3
|
+
import * as fs2 from 'node:fs/promises';
|
|
4
4
|
import * as path4 from 'node:path';
|
|
5
5
|
import { toErrorMessage } from '@wrongstack/core/utils';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
@@ -1325,11 +1325,10 @@ func formatType(t ast.Expr) string {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
`;
|
|
1327
1327
|
async function syncGoParse(filePath, content, lang) {
|
|
1328
|
-
const tmpDir = path4.join(os.tmpdir(), "ws-go-parse");
|
|
1328
|
+
const tmpDir = await fs2.mkdtemp(path4.join(os.tmpdir(), "ws-go-parse-"));
|
|
1329
1329
|
try {
|
|
1330
|
-
await fs6.mkdir(tmpDir, { recursive: true });
|
|
1331
1330
|
const scriptPath = path4.join(tmpDir, "parse.go");
|
|
1332
|
-
await
|
|
1331
|
+
await fs2.writeFile(scriptPath, GO_PARSE_SCRIPT, "utf8");
|
|
1333
1332
|
const proc = spawn("go", ["run", scriptPath], {
|
|
1334
1333
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1335
1334
|
windowsHide: true
|
|
@@ -1371,6 +1370,8 @@ async function syncGoParse(filePath, content, lang) {
|
|
|
1371
1370
|
return { file: filePath, lang, symbols, mtimeMs: Date.now() };
|
|
1372
1371
|
} catch {
|
|
1373
1372
|
return { file: filePath, lang, symbols: [], mtimeMs: Date.now() };
|
|
1373
|
+
} finally {
|
|
1374
|
+
await fs2.rm(tmpDir, { recursive: true, force: true });
|
|
1374
1375
|
}
|
|
1375
1376
|
}
|
|
1376
1377
|
async function parseSymbols3(opts) {
|
|
@@ -1589,9 +1590,9 @@ async function syncPyParse(filePath, content, lang) {
|
|
|
1589
1590
|
try {
|
|
1590
1591
|
if (!_cachedScriptPath) {
|
|
1591
1592
|
const tmpDir = path4.join(os.tmpdir(), "ws-py-parse");
|
|
1592
|
-
await
|
|
1593
|
+
await fs2.mkdir(tmpDir, { recursive: true });
|
|
1593
1594
|
_cachedScriptPath = path4.join(tmpDir, "parse.py");
|
|
1594
|
-
await
|
|
1595
|
+
await fs2.writeFile(_cachedScriptPath, PY_PARSE_SCRIPT, "utf8");
|
|
1595
1596
|
}
|
|
1596
1597
|
const proc = spawn("python", [_cachedScriptPath, filePath], {
|
|
1597
1598
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -1675,7 +1676,7 @@ async function tryNativeParse(file, content) {
|
|
|
1675
1676
|
const toolsDir = path4.join(process.cwd(), "tools");
|
|
1676
1677
|
const crateDir = path4.join(toolsDir, "syn-parser");
|
|
1677
1678
|
const tmpFile = path4.join(crateDir, "src", "input.rs");
|
|
1678
|
-
await
|
|
1679
|
+
await fs2.writeFile(tmpFile, content, "utf8");
|
|
1679
1680
|
const proc = spawn(
|
|
1680
1681
|
"cargo",
|
|
1681
1682
|
["run", "--manifest-path", path4.join(toolsDir, "Cargo.toml")],
|
|
@@ -2170,7 +2171,7 @@ function compileGitignore(lines) {
|
|
|
2170
2171
|
async function loadGitignoreMatcher(projectRoot) {
|
|
2171
2172
|
let lines = [];
|
|
2172
2173
|
try {
|
|
2173
|
-
const raw = await
|
|
2174
|
+
const raw = await fs2.readFile(path4.join(projectRoot, ".gitignore"), "utf8");
|
|
2174
2175
|
lines = raw.split("\n");
|
|
2175
2176
|
} catch {
|
|
2176
2177
|
}
|
|
@@ -2228,7 +2229,7 @@ async function findSourceFiles(projectRoot, ignore, isGitIgnored, signal) {
|
|
|
2228
2229
|
}
|
|
2229
2230
|
let entries;
|
|
2230
2231
|
try {
|
|
2231
|
-
entries = await
|
|
2232
|
+
entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
2232
2233
|
} catch {
|
|
2233
2234
|
return;
|
|
2234
2235
|
}
|
|
@@ -2328,7 +2329,7 @@ async function runIndexerWithStore(store, opts) {
|
|
|
2328
2329
|
batchFiles.map(async (file) => {
|
|
2329
2330
|
let stat2;
|
|
2330
2331
|
try {
|
|
2331
|
-
stat2 = await
|
|
2332
|
+
stat2 = await fs2.stat(file, statOpts);
|
|
2332
2333
|
} catch (e) {
|
|
2333
2334
|
if (isAbortError(e)) throw e;
|
|
2334
2335
|
return { file, stat: null, lang: "", parsed: null, error: `stat error: ${e instanceof Error ? e.message : String(e)}` };
|
|
@@ -2342,7 +2343,7 @@ async function runIndexerWithStore(store, opts) {
|
|
|
2342
2343
|
}
|
|
2343
2344
|
let content;
|
|
2344
2345
|
try {
|
|
2345
|
-
content = await
|
|
2346
|
+
content = await fs2.readFile(file, { encoding: "utf8", signal });
|
|
2346
2347
|
} catch (e) {
|
|
2347
2348
|
if (isAbortError(e)) throw e;
|
|
2348
2349
|
return { file, stat: stat2, lang, parsed: null, error: `read error: ${e instanceof Error ? e.message : String(e)}` };
|