@venizia/dev-configs 0.4.3 → 0.4.4
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/LICENSE.md +2 -5
- package/README.md +15 -2
- package/dist/checks/catalog.d.ts +39 -0
- package/dist/checks/catalog.d.ts.map +1 -0
- package/dist/checks/catalog.js +94 -0
- package/dist/checks/catalog.js.map +1 -0
- package/dist/checks/index.d.ts +11 -0
- package/dist/checks/index.d.ts.map +1 -0
- package/dist/checks/index.js +27 -0
- package/dist/checks/index.js.map +1 -0
- package/dist/checks/module-cycles.d.ts +22 -0
- package/dist/checks/module-cycles.d.ts.map +1 -0
- package/dist/checks/module-cycles.js +149 -0
- package/dist/checks/module-cycles.js.map +1 -0
- package/dist/checks/purity/manifest.d.ts +94 -0
- package/dist/checks/purity/manifest.d.ts.map +1 -0
- package/dist/checks/purity/manifest.js +177 -0
- package/dist/checks/purity/manifest.js.map +1 -0
- package/dist/checks/purity/probe.d.ts +68 -0
- package/dist/checks/purity/probe.d.ts.map +1 -0
- package/dist/checks/purity/probe.js +295 -0
- package/dist/checks/purity/probe.js.map +1 -0
- package/dist/checks/purity/run.d.ts +47 -0
- package/dist/checks/purity/run.d.ts.map +1 -0
- package/dist/checks/purity/run.js +121 -0
- package/dist/checks/purity/run.js.map +1 -0
- package/dist/checks/split-report.d.ts +19 -0
- package/dist/checks/split-report.d.ts.map +1 -0
- package/dist/checks/split-report.js +123 -0
- package/dist/checks/split-report.js.map +1 -0
- package/dist/cli/check.d.ts +10 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +206 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/codemod/const-classes.d.ts +80 -0
- package/dist/cli/codemod/const-classes.d.ts.map +1 -0
- package/dist/cli/codemod/const-classes.js +603 -0
- package/dist/cli/codemod/const-classes.js.map +1 -0
- package/dist/cli/codemod/drop-redundant-casts.d.ts +112 -0
- package/dist/cli/codemod/drop-redundant-casts.d.ts.map +1 -0
- package/dist/cli/codemod/drop-redundant-casts.js +780 -0
- package/dist/cli/codemod/drop-redundant-casts.js.map +1 -0
- package/dist/cli/codemod/index.d.ts +2 -1
- package/dist/cli/codemod/index.d.ts.map +1 -1
- package/dist/cli/codemod/index.js +25 -7
- package/dist/cli/codemod/index.js.map +1 -1
- package/dist/cli/codemod/model-settings.d.ts.map +1 -1
- package/dist/cli/codemod/model-settings.js +39 -2
- package/dist/cli/codemod/model-settings.js.map +1 -1
- package/dist/cli/index.js +9 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/repo-tmp.d.ts +12 -0
- package/dist/testing/repo-tmp.d.ts.map +1 -0
- package/dist/testing/repo-tmp.js +67 -0
- package/dist/testing/repo-tmp.js.map +1 -0
- package/dist/testing/spawn.helper.d.ts +13 -0
- package/dist/testing/spawn.helper.d.ts.map +1 -0
- package/dist/testing/spawn.helper.js +22 -0
- package/dist/testing/spawn.helper.js.map +1 -0
- package/dist/testing/tmpdir-preload.d.ts +2 -0
- package/dist/testing/tmpdir-preload.d.ts.map +1 -0
- package/dist/testing/tmpdir-preload.js +9 -0
- package/dist/testing/tmpdir-preload.js.map +1 -0
- package/package.json +9 -1
- package/src/tsconfig/tsconfig.base.json +5 -2
- package/src/tsconfig/tsconfig.common.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The folder under the repository root that holds a test run's temp folders. */
|
|
2
|
+
export declare const REPO_TMP_DIRECTORY: string;
|
|
3
|
+
/** The nearest ancestor of `start` that holds a `.git` (folder or file); `start` itself when there is none. */
|
|
4
|
+
export declare const findRepositoryRoot: (start?: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Points TMPDIR at the repository's test folder unless it is already inside it (make's value, or a
|
|
7
|
+
* private folder a caller made there), and returns the folder now in force. Idempotent.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useRepoTmp: (opts?: {
|
|
10
|
+
root?: string;
|
|
11
|
+
}) => string;
|
|
12
|
+
//# sourceMappingURL=repo-tmp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-tmp.d.ts","sourceRoot":"","sources":["../../src/testing/repo-tmp.ts"],"names":[],"mappings":"AAWA,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,QAA2C,CAAC;AAE3E,+GAA+G;AAC/G,eAAO,MAAM,kBAAkB,GAAI,QAAO,MAAsB,KAAG,MAelE,CAAC;AAwBF;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAM;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,KAAG,MAkBzD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useRepoTmp = exports.findRepositoryRoot = exports.REPO_TMP_DIRECTORY = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Where a test makes its temp folders: `.agents/local/tmp/tests` of the repository, never the system
|
|
6
|
+
* temp. `make test` sets TMPDIR to a folder like it; this does the same for a run without make - a
|
|
7
|
+
* bare `bun test` on one file - and is the one place that knows the path.
|
|
8
|
+
*
|
|
9
|
+
* The empty `.git` marker in it stops git and bun's ignore lookup from reading the enclosing
|
|
10
|
+
* repository, so GIT_CEILING_DIRECTORIES is set to the same folder.
|
|
11
|
+
*/
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
/** The folder under the repository root that holds a test run's temp folders. */
|
|
15
|
+
exports.REPO_TMP_DIRECTORY = (0, node_path_1.join)('.agents', 'local', 'tmp', 'tests');
|
|
16
|
+
/** The nearest ancestor of `start` that holds a `.git` (folder or file); `start` itself when there is none. */
|
|
17
|
+
const findRepositoryRoot = (start = process.cwd()) => {
|
|
18
|
+
let current = (0, node_path_1.resolve)(start);
|
|
19
|
+
for (;;) {
|
|
20
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(current, '.git'))) {
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
const parent = (0, node_path_1.dirname)(current);
|
|
24
|
+
if (parent === current) {
|
|
25
|
+
return (0, node_path_1.resolve)(start);
|
|
26
|
+
}
|
|
27
|
+
current = parent;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.findRepositoryRoot = findRepositoryRoot;
|
|
31
|
+
/**
|
|
32
|
+
* `Bun.spawn` and `Bun.spawnSync` hand a child the environment the process started with, not the one
|
|
33
|
+
* it has now, so a TMPDIR set here would never reach it. Wrapped to default to the current one; an
|
|
34
|
+
* `env` a caller passes wins. `spawn(cmd, options)` and `spawn({ cmd, ...options })` are both handled.
|
|
35
|
+
*/
|
|
36
|
+
const withCurrentEnv = (spawn) => {
|
|
37
|
+
return (...args) => {
|
|
38
|
+
const [first, second] = args;
|
|
39
|
+
const options = Array.isArray(first) ? second : first;
|
|
40
|
+
if (options?.env !== undefined) {
|
|
41
|
+
return spawn(...args);
|
|
42
|
+
}
|
|
43
|
+
return Array.isArray(first)
|
|
44
|
+
? spawn(first, { ...second, env: process.env })
|
|
45
|
+
: spawn({ ...first, env: process.env });
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Points TMPDIR at the repository's test folder unless it is already inside it (make's value, or a
|
|
50
|
+
* private folder a caller made there), and returns the folder now in force. Idempotent.
|
|
51
|
+
*/
|
|
52
|
+
const useRepoTmp = (opts = {}) => {
|
|
53
|
+
const root = opts.root ?? (0, exports.findRepositoryRoot)();
|
|
54
|
+
const testTmp = (0, node_path_1.join)(root, exports.REPO_TMP_DIRECTORY);
|
|
55
|
+
const current = process.env.TMPDIR;
|
|
56
|
+
if (current !== undefined && `${(0, node_path_1.resolve)(current)}${node_path_1.sep}`.startsWith(`${testTmp}${node_path_1.sep}`)) {
|
|
57
|
+
return current;
|
|
58
|
+
}
|
|
59
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(testTmp, '.git'), { recursive: true });
|
|
60
|
+
process.env.TMPDIR = testTmp;
|
|
61
|
+
process.env.GIT_CEILING_DIRECTORIES = testTmp;
|
|
62
|
+
Bun.spawn = withCurrentEnv(Bun.spawn);
|
|
63
|
+
Bun.spawnSync = withCurrentEnv(Bun.spawnSync);
|
|
64
|
+
return testTmp;
|
|
65
|
+
};
|
|
66
|
+
exports.useRepoTmp = useRepoTmp;
|
|
67
|
+
//# sourceMappingURL=repo-tmp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-tmp.js","sourceRoot":"","sources":["../../src/testing/repo-tmp.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,qCAAgD;AAChD,yCAAwD;AAExD,iFAAiF;AACpE,QAAA,kBAAkB,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAE3E,+GAA+G;AACxG,MAAM,kBAAkB,GAAG,CAAC,QAAgB,OAAO,CAAC,GAAG,EAAE,EAAU,EAAE;IAC1E,IAAI,OAAO,GAAG,IAAA,mBAAO,EAAC,KAAK,CAAC,CAAC;IAE7B,SAAS,CAAC;QACR,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YACtC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACvB,OAAO,IAAA,mBAAO,EAAC,KAAK,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B;AAIF;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE;IAC/C,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;QACjB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;QAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;QAEtD,IAAK,OAAyC,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAClE,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QACxB,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACzB,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,GAAI,MAAiB,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;YAC3D,CAAC,CAAC,KAAK,CAAC,EAAE,GAAI,KAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,OAA0B,EAAE,EAAU,EAAE;IACjE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAA,0BAAkB,GAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAA,gBAAI,EAAC,IAAI,EAAE,0BAAkB,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;IAEnC,IAAI,OAAO,KAAK,SAAS,IAAI,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,eAAG,EAAE,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,eAAG,EAAE,CAAC,EAAE,CAAC;QACxF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAA,mBAAS,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,OAAO,CAAC;IAC9C,GAAG,CAAC,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,KAA0B,CAAgC,CAAC;IAC1F,GAAG,CAAC,SAAS,GAAG,cAAc,CAC5B,GAAG,CAAC,SAA8B,CACA,CAAC;IAErC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAlBW,QAAA,UAAU,cAkBrB","sourcesContent":["/**\n * Where a test makes its temp folders: `.agents/local/tmp/tests` of the repository, never the system\n * temp. `make test` sets TMPDIR to a folder like it; this does the same for a run without make - a\n * bare `bun test` on one file - and is the one place that knows the path.\n *\n * The empty `.git` marker in it stops git and bun's ignore lookup from reading the enclosing\n * repository, so GIT_CEILING_DIRECTORIES is set to the same folder.\n */\nimport { existsSync, mkdirSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\n\n/** The folder under the repository root that holds a test run's temp folders. */\nexport const REPO_TMP_DIRECTORY = join('.agents', 'local', 'tmp', 'tests');\n\n/** The nearest ancestor of `start` that holds a `.git` (folder or file); `start` itself when there is none. */\nexport const findRepositoryRoot = (start: string = process.cwd()): string => {\n let current = resolve(start);\n\n for (;;) {\n if (existsSync(join(current, '.git'))) {\n return current;\n }\n\n const parent = dirname(current);\n if (parent === current) {\n return resolve(start);\n }\n\n current = parent;\n }\n};\n\ntype TSpawn = (...args: unknown[]) => unknown;\n\n/**\n * `Bun.spawn` and `Bun.spawnSync` hand a child the environment the process started with, not the one\n * it has now, so a TMPDIR set here would never reach it. Wrapped to default to the current one; an\n * `env` a caller passes wins. `spawn(cmd, options)` and `spawn({ cmd, ...options })` are both handled.\n */\nconst withCurrentEnv = (spawn: TSpawn): TSpawn => {\n return (...args) => {\n const [first, second] = args;\n const options = Array.isArray(first) ? second : first;\n\n if ((options as { env?: unknown } | undefined)?.env !== undefined) {\n return spawn(...args);\n }\n\n return Array.isArray(first)\n ? spawn(first, { ...(second as object), env: process.env })\n : spawn({ ...(first as object), env: process.env });\n };\n};\n\n/**\n * Points TMPDIR at the repository's test folder unless it is already inside it (make's value, or a\n * private folder a caller made there), and returns the folder now in force. Idempotent.\n */\nexport const useRepoTmp = (opts: { root?: string } = {}): string => {\n const root = opts.root ?? findRepositoryRoot();\n const testTmp = join(root, REPO_TMP_DIRECTORY);\n const current = process.env.TMPDIR;\n\n if (current !== undefined && `${resolve(current)}${sep}`.startsWith(`${testTmp}${sep}`)) {\n return current;\n }\n\n mkdirSync(join(testTmp, '.git'), { recursive: true });\n process.env.TMPDIR = testTmp;\n process.env.GIT_CEILING_DIRECTORIES = testTmp;\n Bun.spawn = withCurrentEnv(Bun.spawn as unknown as TSpawn) as unknown as typeof Bun.spawn;\n Bun.spawnSync = withCurrentEnv(\n Bun.spawnSync as unknown as TSpawn,\n ) as unknown as typeof Bun.spawnSync;\n\n return testTmp;\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */
|
|
2
|
+
export declare const SPAWN_TIMEOUT_MS = 120000;
|
|
3
|
+
/**
|
|
4
|
+
* `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot
|
|
5
|
+
* fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be
|
|
6
|
+
* outlived by a stuck child - one such child once stalled a whole suite for 770s - so this kills with
|
|
7
|
+
* SIGKILL, and throws naming the command instead of returning a half-finished result.
|
|
8
|
+
*/
|
|
9
|
+
export declare const spawnSyncBounded: <const In extends Bun.SpawnOptions.Writable = "ignore", const Out extends Bun.SpawnOptions.Readable = "pipe", const Err extends Bun.SpawnOptions.Readable = "pipe">(opts: Bun.SpawnOptions.SpawnSyncOptions<In, Out, Err> & {
|
|
10
|
+
cmd: string[];
|
|
11
|
+
onExit?: undefined;
|
|
12
|
+
}) => Bun.SyncSubprocess<Out, Err>;
|
|
13
|
+
//# sourceMappingURL=spawn.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.helper.d.ts","sourceRoot":"","sources":["../../src/testing/spawn.helper.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,eAAO,MAAM,gBAAgB,SAAU,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,CAAC,EAAE,SAAS,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,QAAQ,EACrD,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,MAAM,EACpD,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,YAAY,CAAC,QAAQ,GAAG,MAAM,EAEpD,MAAM,GAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,iCAa9F,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.spawnSyncBounded = exports.SPAWN_TIMEOUT_MS = void 0;
|
|
4
|
+
/** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */
|
|
5
|
+
exports.SPAWN_TIMEOUT_MS = 120_000;
|
|
6
|
+
/**
|
|
7
|
+
* `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot
|
|
8
|
+
* fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be
|
|
9
|
+
* outlived by a stuck child - one such child once stalled a whole suite for 770s - so this kills with
|
|
10
|
+
* SIGKILL, and throws naming the command instead of returning a half-finished result.
|
|
11
|
+
*/
|
|
12
|
+
const spawnSyncBounded = (opts) => {
|
|
13
|
+
const timeout = opts.timeout ?? exports.SPAWN_TIMEOUT_MS;
|
|
14
|
+
const result = Bun.spawnSync({ ...opts, timeout, killSignal: 'SIGKILL' });
|
|
15
|
+
if (result.exitedDueToTimeout) {
|
|
16
|
+
// eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
|
|
17
|
+
throw new Error(`[spawnSyncBounded] did not exit within ${timeout} ms, killed | cmd: ${opts.cmd.join(' ').slice(0, 200)}`);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
exports.spawnSyncBounded = spawnSyncBounded;
|
|
22
|
+
//# sourceMappingURL=spawn.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.helper.js","sourceRoot":"","sources":["../../src/testing/spawn.helper.ts"],"names":[],"mappings":";;;AAAA,yGAAyG;AAC5F,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAExC;;;;;GAKG;AACI,MAAM,gBAAgB,GAAG,CAK9B,IAA6F,EAC7F,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,wBAAgB,CAAC;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAe,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,SAAkB,EAAE,CAAC,CAAC;IAEjG,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC9B,sGAAsG;QACtG,MAAM,IAAI,KAAK,CACb,0CAA0C,OAAO,sBAAsB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAC1G,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,gBAAgB,oBAkB3B","sourcesContent":["/** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */\nexport const SPAWN_TIMEOUT_MS = 120_000;\n\n/**\n * `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot\n * fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be\n * outlived by a stuck child - one such child once stalled a whole suite for 770s - so this kills with\n * SIGKILL, and throws naming the command instead of returning a half-finished result.\n */\nexport const spawnSyncBounded = <\n const In extends Bun.SpawnOptions.Writable = 'ignore',\n const Out extends Bun.SpawnOptions.Readable = 'pipe',\n const Err extends Bun.SpawnOptions.Readable = 'pipe',\n>(\n opts: Bun.SpawnOptions.SpawnSyncOptions<In, Out, Err> & { cmd: string[]; onExit?: undefined },\n) => {\n const timeout = opts.timeout ?? SPAWN_TIMEOUT_MS;\n const result = Bun.spawnSync<In, Out, Err>({ ...opts, timeout, killSignal: 'SIGKILL' as const });\n\n if (result.exitedDueToTimeout) {\n // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n `[spawnSyncBounded] did not exit within ${timeout} ms, killed | cmd: ${opts.cmd.join(' ').slice(0, 200)}`,\n );\n }\n\n return result;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmpdir-preload.d.ts","sourceRoot":"","sources":["../../src/testing/tmpdir-preload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Test preload: `[test] preload = ["@venizia/dev-configs/testing/tmpdir-preload"]` in a bunfig makes
|
|
5
|
+
* a bare `bun test` keep its temp folders in the repository, like `make test` does.
|
|
6
|
+
*/
|
|
7
|
+
const repo_tmp_1 = require("./repo-tmp");
|
|
8
|
+
(0, repo_tmp_1.useRepoTmp)();
|
|
9
|
+
//# sourceMappingURL=tmpdir-preload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmpdir-preload.js","sourceRoot":"","sources":["../../src/testing/tmpdir-preload.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,yCAAwC;AAExC,IAAA,qBAAU,GAAE,CAAC","sourcesContent":["/**\n * Test preload: `[test] preload = [\"@venizia/dev-configs/testing/tmpdir-preload\"]` in a bunfig makes\n * a bare `bun test` keep its temp folders in the repository, like `make test` does.\n */\nimport { useRepoTmp } from './repo-tmp';\n\nuseRepoTmp();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/dev-configs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Shareable development configurations for TypeScript projects: oxlint presets with per-rule builders, the ESLint naming-convention rule, the legacy ESLint flat config, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build-tools",
|
|
@@ -83,10 +83,18 @@
|
|
|
83
83
|
"types": "./dist/linters/oxlint-presets.d.ts",
|
|
84
84
|
"default": "./dist/linters/oxlint-presets.js"
|
|
85
85
|
},
|
|
86
|
+
"./checks": {
|
|
87
|
+
"types": "./dist/checks/index.d.ts",
|
|
88
|
+
"default": "./dist/checks/index.js"
|
|
89
|
+
},
|
|
86
90
|
"./testing": {
|
|
87
91
|
"types": "./dist/testing/index.d.ts",
|
|
88
92
|
"default": "./dist/testing/index.js"
|
|
89
93
|
},
|
|
94
|
+
"./testing/tmpdir-preload": {
|
|
95
|
+
"types": "./dist/testing/tmpdir-preload.d.ts",
|
|
96
|
+
"default": "./dist/testing/tmpdir-preload.js"
|
|
97
|
+
},
|
|
90
98
|
"./tsconfig.base.json": "./src/tsconfig/tsconfig.base.json",
|
|
91
99
|
"./tsconfig.common.json": "./src/tsconfig/tsconfig.common.json",
|
|
92
100
|
"./tsconfig.browser.json": "./src/tsconfig/tsconfig.browser.json",
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
"useDefineForClassFields": false,
|
|
12
12
|
|
|
13
13
|
/* Modules */
|
|
14
|
-
"module"
|
|
15
|
-
"
|
|
14
|
+
/* IGNIS runs on Bun and ships ES modules only. Bundler resolution reads every import through the "import" condition, so a package whose type is unset resolves the same types as one that says "module". Node16 would read a CommonJS file through "require" and see a second copy of every dual package (drizzle-orm). */
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"moduleResolution": "bundler",
|
|
17
|
+
/* TypeScript 6 checks "import 'x'"; a side-effect import such as 'dotenv-flow/config' has no types to find. */
|
|
18
|
+
"noUncheckedSideEffectImports": false,
|
|
16
19
|
"resolveJsonModule": true,
|
|
17
20
|
"isolatedModules": true,
|
|
18
21
|
"forceConsistentCasingInFileNames": true,
|