@adamhl8/configs 3.5.1 → 4.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.
Files changed (56) hide show
  1. package/README.md +34 -58
  2. package/dist/adamhl8-tsconfig/index +43 -0
  3. package/dist/configs/bask.base.js +13 -11
  4. package/dist/configs/bask.base.js.map +1 -1
  5. package/dist/configs/commitlint.base.js.map +1 -1
  6. package/dist/configs/gitignore.base +0 -1
  7. package/dist/configs/oxlint.base.d.ts +1 -1
  8. package/dist/configs/oxlint.base.js +1 -1
  9. package/dist/configs/oxlint.base.js.map +1 -1
  10. package/dist/configs/tsconfig.base.json +0 -1
  11. package/dist/configs/tsconfig.no-dts.base.json +7 -0
  12. package/dist/configs/tsdown.base.js.map +1 -1
  13. package/dist/test-utils/fixture.d.ts +1 -7
  14. package/dist/test-utils/fixture.js +2 -3
  15. package/dist/test-utils/fixture.js.map +1 -1
  16. package/dist/test-utils/index.d.ts +3 -4
  17. package/dist/test-utils/index.js +3 -4
  18. package/dist/test-utils/pack.d.ts +4 -1
  19. package/dist/test-utils/pack.js +16 -4
  20. package/dist/test-utils/pack.js.map +1 -1
  21. package/dist/test-utils/shell/command.js +1 -1
  22. package/dist/test-utils/temp-dir.d.ts +2 -2
  23. package/dist/test-utils/temp-dir.js +5 -3
  24. package/dist/test-utils/temp-dir.js.map +1 -1
  25. package/dist/utils.js +11 -2
  26. package/dist/utils.js.map +1 -1
  27. package/package.json +21 -43
  28. package/dist/configs/bask.base.d.ts.map +0 -1
  29. package/dist/configs/commitlint.base.d.ts.map +0 -1
  30. package/dist/configs/knip.base.d.ts.map +0 -1
  31. package/dist/configs/oxfmt.base.d.ts.map +0 -1
  32. package/dist/configs/oxlint.base.d.ts.map +0 -1
  33. package/dist/configs/release-it.base.d.ts.map +0 -1
  34. package/dist/configs/tsdown.base.d.ts.map +0 -1
  35. package/dist/env/index.d.ts.map +0 -1
  36. package/dist/env/utils.d.ts.map +0 -1
  37. package/dist/merge-config/merge-config.d.ts.map +0 -1
  38. package/dist/merge-config/merge.types.d.ts.map +0 -1
  39. package/dist/test-utils/fixture.d.ts.map +0 -1
  40. package/dist/test-utils/pack.d.ts.map +0 -1
  41. package/dist/test-utils/shell/command.d.ts.map +0 -1
  42. package/dist/test-utils/shell/env.d.ts.map +0 -1
  43. package/dist/test-utils/shell/shell.d.ts.map +0 -1
  44. package/dist/test-utils/subprocess-coverage/child-preload.d.ts +0 -1
  45. package/dist/test-utils/subprocess-coverage/child-preload.js +0 -73
  46. package/dist/test-utils/subprocess-coverage/child-preload.js.map +0 -1
  47. package/dist/test-utils/subprocess-coverage/env.d.ts +0 -7
  48. package/dist/test-utils/subprocess-coverage/env.d.ts.map +0 -1
  49. package/dist/test-utils/subprocess-coverage/env.js +0 -19
  50. package/dist/test-utils/subprocess-coverage/env.js.map +0 -1
  51. package/dist/test-utils/subprocess-coverage/preload.d.ts +0 -1
  52. package/dist/test-utils/subprocess-coverage/preload.js +0 -43
  53. package/dist/test-utils/subprocess-coverage/preload.js.map +0 -1
  54. package/dist/test-utils/subprocess-coverage/report.js +0 -35
  55. package/dist/test-utils/subprocess-coverage/report.js.map +0 -1
  56. package/dist/test-utils/temp-dir.d.ts.map +0 -1
package/README.md CHANGED
@@ -29,6 +29,7 @@ Configs, tasks, and workflows I use across my TS projects.
29
29
  - [Synced files](#synced-files)
30
30
  - [bunfig](#bunfig)
31
31
  - [gitignore](#gitignore)
32
+ - [tsconfig extends](#tsconfig-extends)
32
33
  - [Utilities](#utilities)
33
34
  - [env](#env)
34
35
  - [test](#test)
@@ -61,7 +62,6 @@ Some tools are only needed by some projects:
61
62
  - Published packages: `tsdown publint @arethetypeswrong/core`
62
63
  - Releases: `release-it release-it-git-cliff` (see [release-it](#release-it))
63
64
  - Astro projects that use Tailwind: `tailwint @tailwindcss/language-server` (see [bask tasks](#bask-tasks))
64
- - Subprocess test coverage: `@vitest/istanbul-lib-coverage @vitest/istanbul-lib-instrument @vitest/istanbul-lib-report @vitest/istanbul-lib-source-maps` (see [Subprocess coverage](#subprocess-coverage))
65
65
 
66
66
  ## Setup
67
67
 
@@ -82,7 +82,7 @@ A project using everything here has these files:
82
82
  | `.github/workflows/*.yml` | [GitHub Actions](#github-actions) |
83
83
  | `github.tofu` | [GitHub repo settings](#github-repo-settings) |
84
84
 
85
- `bunfig.toml` and `.gitignore` are kept up to date by the [synced files](#synced-files).
85
+ `bunfig.toml`, `.gitignore`, and the `extends` in `tsconfig.json` are kept up to date by the [synced files](#synced-files).
86
86
 
87
87
  ## Configs
88
88
 
@@ -118,6 +118,10 @@ The second config works at any depth: only the arrays you provide are replaced,
118
118
 
119
119
  The base tsconfig adds stricter checks like `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes`, with no emit and bundler module resolution. It sets `types: ["bun"]`, so the project needs `@types/bun` installed.
120
120
 
121
+ The base sets `declaration: true` so `tsc` fails on an export whose type can't be named. tsdown doesn't catch this: with Bun's isolated linker, it silently publishes that export as `any`.
122
+
123
+ `@adamhl8/configs/tsconfig/no-dts` is the same config with `declaration` off, so `tsc` doesn't report these errors in a project that never publishes a `.d.ts`. You don't need to choose between them because the [tsconfig sync](#tsconfig-extends) sets `extends` for you.
124
+
121
125
  ### oxfmt
122
126
 
123
127
  ```ts
@@ -260,17 +264,17 @@ export * from "@adamhl8/configs/bask"
260
264
 
261
265
  Run `bunx bask` to list them along with the allowed commit types.
262
266
 
263
- | Task | What it does |
264
- | -------------- | -------------------------------------------------------------------------------------------------------------------------------- |
265
- | `lint` | Updates the README's table of contents, runs oxlint (with fixes), oxfmt, tailwint, `tofu fmt`, knip, and actionlint, then `test` |
266
- | `build` | Runs `lint`, `tsdown`, and `tofu-check`. In CI, it fails when lint fixes or formatting changed any files |
267
- | `test` | Runs `bun test`, which passes when there are no tests |
268
- | `bump-deps` | Updates every dependency to its latest version, then reinstalls without the lockfile, `node_modules`, or bun's cache |
269
- | `release` | Starts the [release workflow](#release) (`gh workflow run release.yml`) |
270
- | `release-run` | Runs `release-it --ci`. It's hidden because only the release workflow runs it |
271
- | `tofu-check` | Runs `tofu plan` to check the [GitHub repo settings](#github-repo-settings) for drift |
272
- | `commit-types` | Prints the allowed commit types |
273
- | `prepare` | Runs `lefthook install`, the [synced files](#synced-files), and `tofu init -upgrade` |
267
+ | Task | What it does |
268
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
269
+ | `lint` | Updates the README's table of contents, runs oxlint (with fixes), oxfmt, tailwint, `tofu fmt`, `tsc`, knip, and actionlint, then `test` |
270
+ | `build` | Runs `lint`, `tsdown`, and `tofu-check`. In CI, it fails when lint fixes or formatting changed any files |
271
+ | `test` | Runs `bun test`, which passes when there are no tests |
272
+ | `bump-deps` | Updates every dependency to its latest version, then reinstalls without the lockfile, `node_modules`, or bun's cache |
273
+ | `release` | Starts the [release workflow](#release) (`gh workflow run release.yml`) |
274
+ | `release-run` | Runs `release-it --ci`. It's hidden because only the release workflow runs it |
275
+ | `tofu-check` | Runs `tofu plan` to check the [GitHub repo settings](#github-repo-settings) for drift |
276
+ | `commit-types` | Prints the allowed commit types |
277
+ | `prepare` | Runs `lefthook install`, the [synced files](#synced-files), and `tofu init -upgrade` |
274
278
 
275
279
  The tasks skip the steps a project doesn't need, so projects can use them as-is:
276
280
 
@@ -350,6 +354,17 @@ dist/
350
354
 
351
355
  Everything below the marker is left untouched. The sync can also be run manually by running `adamhl8-gitignore`.
352
356
 
357
+ ### tsconfig extends
358
+
359
+ A tsconfig can't branch on the project, so the right base config is synced into the project's `tsconfig.json`. The `prepare` task runs the `adamhl8-tsconfig` bin, which sets `extends` based on whether the `package.json` declares types:
360
+
361
+ - `@adamhl8/configs/tsconfig` when it has a top-level `types` or `typings` field, or a `types` condition or declaration file path anywhere in `exports`
362
+ - `@adamhl8/configs/tsconfig/no-dts` otherwise
363
+
364
+ A package that publishes types has to declare them for this to work. TypeScript also finds a `.d.ts` next to its `.js` without one, but this sync would then turn off the `declaration` check that protects those types.
365
+
366
+ Only the `extends` value changes, so comments, formatting, and other options are left untouched. To opt out, extend anything other than these two configs, or set `declaration` in the project's own `compilerOptions`. The sync can also be run manually by running `adamhl8-tsconfig`.
367
+
353
368
  ## Utilities
354
369
 
355
370
  ### env
@@ -377,7 +392,7 @@ Helpers for integration tests that run real commands in temp dirs, exported from
377
392
  ```ts
378
393
  import { copyFixture, minimalEnv, packPackage } from "@adamhl8/configs/test"
379
394
 
380
- const tarball = await packPackage(ROOT) // once per run, like in a preload's `beforeAll`
395
+ const tarball = await packPackage(ROOT)
381
396
  const { dir, run } = await copyFixture(FIXTURE, { shell: { env: minimalEnv() } })
382
397
  await run`bun add -d ${tarball}`
383
398
 
@@ -394,11 +409,10 @@ const { exitCode: failedCode } = await run`my-cli --bad-flag`.nothrow()
394
409
  - Each command can chain `.cwd()`, `.env()` (merged over the shell's), `.localBins()`, and `.nothrow()`.
395
410
  - The `node` shims from `bask` and `bun run --bun` are taken off `PATH`, so `node` is always the real Node.
396
411
  - Commands read the test runner's stdin, so add `< /dev/null` to a command that might prompt.
397
- - `copyFixture(fixture, { prefix, shell })` copies a fixture dir into a temp dir and returns the `dir` plus a `run` shell bound to it. `shell` takes the `createShell` options except `cwd`.
398
- - `packPackage(root)` runs `bun tsdown` when `root` has a `tsdown.config.ts`, then packs it with `bun pm pack --ignore-scripts` into a temp dir, and returns the tarball path.
412
+ - `copyFixture(fixture, { shell })` copies a fixture dir into a temp dir and returns the `dir` plus a `run` shell bound to it. `shell` takes the `createShell` options except `cwd`.
413
+ - `packPackage(root)` runs `bun tsdown` when `root` has a `tsdown.config.ts`, then packs it with `bun pm pack --ignore-scripts` into a temp dir, and returns the tarball path. It runs once per resolved `root` for the life of the test process, so call it wherever a test needs the tarball. Concurrent callers share one build, and a failed pack fails every caller the same way.
399
414
  - `minimalEnv(extra)` returns just `PATH` and `HOME`, plus `extra`.
400
- - `makeTempDir(prefix)` makes a temp dir that's removed after the test run. `copyFixture` and `packPackage` use it.
401
- - `subprocessCoverageEnv()` returns the variables that turn on [subprocess coverage](#subprocess-coverage) for a shell's `env`, or nothing when it's off.
415
+ - `makeTempDir()` makes a temp dir that's removed after the test run. Its name starts with the name of the current working directory, so a dir left behind by a killed run shows which project it came from. `copyFixture` and `packPackage` use it.
402
416
 
403
417
  The temp dirs are removed by a preload, which each project adds to its `bunfig.toml`:
404
418
 
@@ -415,46 +429,6 @@ import "@adamhl8/configs/test/preload"
415
429
 
416
430
  It isn't in the shared bunfig base because `adamhl8-bunfig` merges arrays by index, so a project's own `preload` would replace it.
417
431
 
418
- #### Subprocess coverage
419
-
420
- Bun's coverage only measures the test process, so it misses a package's own code when tests run it from the packed tarball in child processes. A second preload covers that code, imported after the first at the top of the project's own preload:
421
-
422
- ```ts
423
- import "@adamhl8/configs/test/preload"
424
- import "@adamhl8/configs/test/subprocess-coverage"
425
- ```
426
-
427
- A project without its own preload can list both in `bunfig.toml` instead:
428
-
429
- ```toml
430
- [test]
431
- preload = ["@adamhl8/configs/test/preload", "@adamhl8/configs/test/subprocess-coverage"]
432
- ```
433
-
434
- - It sets `BUN_OPTIONS` and a settings variable on `process.env`. Every Bun process started with them loads a preload that instruments the installed package's `dist/` with Istanbul (the package named in the project's `package.json`).
435
- - A shell that inherits `process.env` passes the variables on as is. A shell that replaces it, like one built on `minimalEnv()`, adds them with `subprocessCoverageEnv()`:
436
-
437
- ```ts
438
- import { copyFixture, minimalEnv, subprocessCoverageEnv } from "@adamhl8/configs/test"
439
-
440
- const { run } = await copyFixture(FIXTURE, { shell: { env: minimalEnv(subprocessCoverageEnv()) } })
441
- ```
442
-
443
- - After the run, the coverage from every process is merged, mapped back to `src/` through the package's source maps, printed as a table (statements, branches, functions, lines), and written to `coverage/subprocess/lcov.info`, which keeps it apart from the `coverage/lcov.info` that Bun writes.
444
- - To keep Bun's own coverage for code that tests import directly, leave `coverage = true` under `[test]` and list the files that subprocess coverage owns in `coveragePathIgnorePatterns`. Bun then skips those files, and the subprocess report keeps only them, so each file appears in one of the two tables. A file you don't list is left to Bun, so a file that only child processes load shows up in neither table. With `coverage = false`, the subprocess report keeps every file.
445
-
446
- ```toml
447
- [test]
448
- coverage = true
449
- coveragePathIgnorePatterns = ["**/__tests__/**", "src/cli/**"]
450
- ```
451
-
452
- - This reads `bunfig.toml` from the project root, so turning on Bun's coverage with `--coverage` instead leaves the subprocess report unfiltered.
453
- - The project needs the optional peer dependencies listed under [Installation](#installation) and a build with source maps, which `tsdownConfig` produces. Tests have to install the packed tarball, as with `packPackage`, because only the installed `dist/` is instrumented.
454
- - A process killed by a signal writes no coverage. An `exit` listener that the package adds in the same tick as a synchronous `process.exit()` isn't counted.
455
-
456
- Import it only from a preload. Imported from a test file, its `afterAll` would be scoped to that file, so the report would run after that file instead of after the whole run.
457
-
458
432
  ## GitHub Actions
459
433
 
460
434
  This repo hosts three reusable workflows you can call from other projects instead of copy/pasting them. The calling project must use `bun`, have a `bask.ts` that re-exports the base tasks (see [bask tasks](#bask-tasks)), and have a commitlint config (e.g. via these configs). The workflows set up bun, actionlint, and OpenTofu themselves.
@@ -618,3 +592,5 @@ The `prepare` task runs `tofu init -upgrade`, and the `tofu-check` task (which `
618
592
  bun links a dependency's `package.json` bin executables into the local `node_modules/.bin`, but not the bins of the package being developed itself. This repo depends on itself (`"@adamhl8/configs": "file:."`) so that its own bins can be run directly, e.g. `adamhl8-bunfig` instead of `src/adamhl8-bunfig/index.ts`. That's also why this repo's `bask.ts` runs `tsdown` before the `prepare` task: the bins point at `dist/`, so those builds need to be available.
619
593
 
620
594
  With bun's `isolated` linker, the self-dependency is a copy made at install time. After adding or moving an export, run `bun install --force` to refresh the copy, or type checks of code that imports the new export fail.
595
+
596
+ `bun.lock` records this repo's bins on the self-dependency's entry, and `bun install` doesn't update an existing entry. After adding a bin, add it to that entry by hand, or `bun install` fails in the `prepare` task with `Script not found`. Running `rm bun.lock && bun install` also updates the entry, but it can pick up newer dependency versions.
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bun
2
+ import bun from "bun";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { isPlainObject } from "es-toolkit/predicate";
5
+ const keysOf = (value) => isPlainObject(value) ? Object.keys(value) : [];
6
+ const DECLARATION_FILE = /\.d\.[cm]?ts$/v;
7
+ /** Checks an `exports` value, at any depth, for a `types` condition or a path to a declaration file. */
8
+ const exportsDeclareTypes = (value) => {
9
+ if (typeof value === "string") return DECLARATION_FILE.test(value);
10
+ if (Array.isArray(value)) return value.some(exportsDeclareTypes);
11
+ if (!isPlainObject(value)) return false;
12
+ return "types" in value || Object.values(value).some(exportsDeclareTypes);
13
+ };
14
+ /**
15
+ * Reads the project's `package.json` fields that the base configs branch on. `dependencies` merges the regular, dev,
16
+ * and peer dependency names. `publishesTypes` is true when the `package.json` declares types.
17
+ */
18
+ const readProjectPackageJson = () => {
19
+ const packageJson = existsSync("package.json") ? JSON.parse(readFileSync("package.json", "utf8")) : {};
20
+ const fields = isPlainObject(packageJson) ? packageJson : {};
21
+ return {
22
+ dependencies: new Set([
23
+ "dependencies",
24
+ "devDependencies",
25
+ "peerDependencies"
26
+ ].flatMap((field) => keysOf(fields[field]))),
27
+ engines: new Set(keysOf(fields["engines"])),
28
+ publishesTypes: "types" in fields || "typings" in fields || exportsDeclareTypes(fields["exports"])
29
+ };
30
+ };
31
+ const TSCONFIG_PATH = "tsconfig.json";
32
+ const DTS_CONFIG = "@adamhl8/configs/tsconfig";
33
+ const NO_DTS_CONFIG = "@adamhl8/configs/tsconfig/no-dts";
34
+ const MANAGED_EXTENDS = /(?<key>"extends"\s*:\s*)"@adamhl8\/configs\/tsconfig(?:\/no-dts)?"/v;
35
+ const tsconfigFile = bun.file(TSCONFIG_PATH);
36
+ if (await tsconfigFile.exists()) {
37
+ const { publishesTypes } = readProjectPackageJson();
38
+ const config = publishesTypes ? DTS_CONFIG : NO_DTS_CONFIG;
39
+ const current = await tsconfigFile.text();
40
+ const updated = current.replace(MANAGED_EXTENDS, `$<key>"${config}"`);
41
+ if (updated !== current) await bun.write(TSCONFIG_PATH, updated);
42
+ }
43
+ export {};
@@ -19,9 +19,10 @@ const tofuCheck = task(async ({ sh }) => {
19
19
  });
20
20
  const prepare = task(async ({ sh }) => {
21
21
  if (!inCi) await sh`lefthook install`;
22
- await sh`bun adamhl8-gitignore`;
23
- await sh`bun adamhl8-bunfig`;
24
- await sh`bun oxfmt bunfig.toml`;
22
+ await sh`adamhl8-gitignore`;
23
+ await sh`adamhl8-bunfig`;
24
+ await sh`adamhl8-tsconfig`;
25
+ await sh`oxfmt bunfig.toml`;
25
26
  if (await canRunTofu()) await sh`tofu init -upgrade`;
26
27
  });
27
28
  const bumpDeps = task(async ({ sh }) => {
@@ -34,11 +35,11 @@ const test = task(async ({ sh }) => {
34
35
  await sh`bun test --pass-with-no-tests`.echo(false);
35
36
  });
36
37
  const lint = task(async ({ sh }) => {
37
- await sh`bun markdown-toc -i --bullets - --maxdepth 3 ./README.md`;
38
- await sh`bun oxlint --fix --fix-suggestions --fix-dangerously`;
39
- await sh`bun oxfmt`;
38
+ await sh`markdown-toc -i --bullets - --maxdepth 3 ./README.md`;
39
+ await sh`oxlint --fix --fix-suggestions --fix-dangerously`;
40
+ await sh`oxfmt`;
40
41
  if (resolveProjectTailwind()) {
41
- if ((await lsFiles([":(glob)**/*.astro"])).length > 0) await sh`bun tailwint "**/*.astro"`;
42
+ if ((await lsFiles([":(glob)**/*.astro"])).length > 0) await sh`tailwint "**/*.astro"`;
42
43
  }
43
44
  const tofuFiles = await lsFiles([
44
45
  ":(glob)**/*.tf",
@@ -48,13 +49,14 @@ const lint = task(async ({ sh }) => {
48
49
  ":(glob)**/*.tofutest.hcl"
49
50
  ]);
50
51
  if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`;
51
- await sh`bun knip-bun`;
52
+ await sh`tsc`;
53
+ await sh`knip-bun`;
52
54
  if (existsSync(".github/workflows")) await sh`actionlint`;
53
55
  await test();
54
56
  });
55
57
  const build = task(async ({ sh }) => {
56
58
  await lint();
57
- if (await bun.file("tsdown.config.ts").exists()) await sh`bun tsdown`;
59
+ if (await bun.file("tsdown.config.ts").exists()) await sh`tsdown`;
58
60
  if (inCi) {
59
61
  await sh`git add --intent-to-add --all`;
60
62
  await sh`git diff --exit-code`;
@@ -65,10 +67,10 @@ const release = task(async ({ sh }) => {
65
67
  await sh`gh workflow run release.yml`;
66
68
  });
67
69
  const releaseRun = task({ hidden: true }, async ({ sh }) => {
68
- await sh`bun release-it -VV --ci`;
70
+ await sh`release-it -VV --ci`;
69
71
  });
70
72
  const commitTypes = task(async ({ sh }) => {
71
- const { 2: types } = (await sh`bun commitlint --print-config json`.echo(false).json()).rules["type-enum"];
73
+ const { 2: types } = (await sh`commitlint --print-config json`.echo(false).json()).rules["type-enum"];
72
74
  console.log(`Commit types:\n ${types.join("\n ")}`);
73
75
  });
74
76
  list.after(async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"bask.base.js","names":[],"sources":["../../src/configs/bask.base.ts"],"sourcesContent":["import { existsSync } from \"node:fs\"\n\nimport { list, task } from \"@adamhl8/bask\"\nimport bun, { $, Glob } from \"bun\"\n\nimport { resolveProjectTailwind } from \"#utils.ts\"\n\nconst inCi = Boolean(process.env[\"CI\"])\n\n/** Lists tracked and untracked files matching the pathspecs, skipping gitignored ones. */\nconst lsFiles = async (pathspecs: string[]) => {\n const output = await $`git ls-files -z --cached --others --exclude-standard -- ${pathspecs}`.quiet().text()\n return output.split(\"\\0\").filter(Boolean)\n}\n\n/** Checks that we're not in CI, the repo has a root tofu module, and the aws profile exists on this machine. */\nconst canRunTofu = async () => {\n if (inCi) return false\n const tofuFiles = await Array.fromAsync(new Glob(\"*.tofu\").scan())\n if (tofuFiles.length === 0) return false\n const profiles = await $`aws configure list-profiles`.nothrow().quiet().text()\n return profiles.split(\"\\n\").includes(\"adamhl8\")\n}\n\nexport const tofuCheck = task(async ({ sh }) => {\n if (await canRunTofu()) await sh`tofu plan -detailed-exitcode -concise -compact-warnings`\n})\n\nexport const prepare = task(async ({ sh }) => {\n // Skip `lefthook install` in CI so commits made by the workflows don't run the hooks.\n if (!inCi) await sh`lefthook install`\n await sh`bun adamhl8-gitignore`\n await sh`bun adamhl8-bunfig`\n await sh`bun oxfmt bunfig.toml`\n if (await canRunTofu()) await sh`tofu init -upgrade`\n})\n\nexport const bumpDeps = task(async ({ sh }) => {\n await sh`bunx npm-check-updates --upgrade --format group`\n await sh`rm -f bun.lock`\n await sh`rm -rf node_modules/`\n await sh`bun install --no-summary --no-cache`\n})\n\nexport const test = task(async ({ sh }) => {\n await sh`bun test --pass-with-no-tests`.echo(false)\n})\n\nexport const lint = task(async ({ sh }) => {\n await sh`bun markdown-toc -i --bullets - --maxdepth 3 ./README.md`\n await sh`bun oxlint --fix --fix-suggestions --fix-dangerously`\n await sh`bun oxfmt`\n\n if (resolveProjectTailwind()) {\n // Check for `.astro` files first so projects without them don't need tailwint installed.\n const astroFiles = await lsFiles([\":(glob)**/*.astro\"])\n // Skip `--fix` because tailwint resolves a class conflict by deleting a class by position, not by which one wins.\n if (astroFiles.length > 0) await sh`bun tailwint \"**/*.astro\"`\n }\n\n const tofuFiles = await lsFiles([\n \":(glob)**/*.tf\",\n \":(glob)**/*.tofu\",\n \":(glob)**/*.tfvars\",\n \":(glob)**/*.tftest.hcl\",\n \":(glob)**/*.tofutest.hcl\",\n ])\n if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`\n\n await sh`bun knip-bun`\n if (existsSync(\".github/workflows\")) await sh`actionlint`\n await test()\n})\n\nexport const build = task(async ({ sh }) => {\n await lint()\n if (await bun.file(\"tsdown.config.ts\").exists()) await sh`bun tsdown`\n // Fail in CI if the build changed or created any files, because lint fixes and formatting are applied in place.\n // `--intent-to-add` makes untracked files show up in the diff.\n if (inCi) {\n await sh`git add --intent-to-add --all`\n await sh`git diff --exit-code`\n }\n await tofuCheck()\n})\n\nexport const release = task(async ({ sh }) => {\n await sh`gh workflow run release.yml`\n})\n\nexport const releaseRun = task({ hidden: true }, async ({ sh }) => {\n await sh`bun release-it -VV --ci`\n})\n\nexport const commitTypes = task(async ({ sh }) => {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `commitlint --print-config json` prints\n const config = (await sh`bun commitlint --print-config json`.echo(false).json()) as {\n rules: { \"type-enum\": [number, string, string[]] }\n }\n const { 2: types } = config.rules[\"type-enum\"]\n console.log(`Commit types:\\n ${types.join(\"\\n \")}`)\n})\n\nlist.after(async () => {\n console.log()\n await commitTypes()\n})\n"],"mappings":";;;;;AAOA,MAAM,OAAO,QAAQ,QAAQ,IAAI,KAAK;;AAGtC,MAAM,UAAU,OAAO,cAAwB;CAE7C,QAAO,MADc,CAAC,2DAA2D,YAAY,MAAM,CAAC,CAAC,KAAK,EAAA,CAC5F,MAAM,IAAI,CAAC,CAAC,OAAO,OAAO;AAC1C;;AAGA,MAAM,aAAa,YAAY;CAC7B,IAAI,MAAM,OAAO;CAEjB,KAAI,MADoB,MAAM,UAAU,IAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAA,CACnD,WAAW,GAAG,OAAO;CAEnC,QAAO,MADgB,CAAC,8BAA8B,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAA,CAC7D,MAAM,IAAI,CAAC,CAAC,SAAS,SAAS;AAChD;AAEA,MAAa,YAAY,KAAK,OAAO,EAAE,SAAS;CAC9C,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE;AAClC,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAE5C,IAAI,CAAC,MAAM,MAAM,EAAE;CACnB,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE;AAClC,CAAC;AAED,MAAa,WAAW,KAAK,OAAO,EAAE,SAAS;CAC7C,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;AACV,CAAC;AAED,MAAa,OAAO,KAAK,OAAO,EAAE,SAAS;CACzC,MAAM,EAAE,gCAAgC,KAAK,KAAK;AACpD,CAAC;AAED,MAAa,OAAO,KAAK,OAAO,EAAE,SAAS;CACzC,MAAM,EAAE;CACR,MAAM,EAAE;CACR,MAAM,EAAE;CAER,IAAI,uBAAuB,GAIrB;OAAA,MAFqB,QAAQ,CAAC,mBAAmB,CAAC,EAAA,CAEvC,SAAS,GAAG,MAAM,EAAE;CAAA;CAGrC,MAAM,YAAY,MAAM,QAAQ;EAC9B;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,IAAI,UAAU,SAAS,GAAG,MAAM,EAAE,YAAY;CAE9C,MAAM,EAAE;CACR,IAAI,WAAW,mBAAmB,GAAG,MAAM,EAAE;CAC7C,MAAM,KAAK;AACb,CAAC;AAED,MAAa,QAAQ,KAAK,OAAO,EAAE,SAAS;CAC1C,MAAM,KAAK;CACX,IAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC,CAAC,OAAO,GAAG,MAAM,EAAE;CAGzD,IAAI,MAAM;EACR,MAAM,EAAE;EACR,MAAM,EAAE;CACV;CACA,MAAM,UAAU;AAClB,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAC5C,MAAM,EAAE;AACV,CAAC;AAED,MAAa,aAAa,KAAK,EAAE,QAAQ,KAAK,GAAG,OAAO,EAAE,SAAS;CACjE,MAAM,EAAE;AACV,CAAC;AAED,MAAa,cAAc,KAAK,OAAO,EAAE,SAAS;CAKhD,MAAM,EAAE,GAAG,WAAU,MAHC,EAAE,qCAAqC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAA,CAGlD,MAAM;CAClC,QAAQ,IAAI,sBAAsB,MAAM,KAAK,QAAQ,GAAG;AAC1D,CAAC;AAED,KAAK,MAAM,YAAY;CACrB,QAAQ,IAAI;CACZ,MAAM,YAAY;AACpB,CAAC"}
1
+ {"version":3,"file":"bask.base.js","names":[],"sources":["../../src/configs/bask.base.ts"],"sourcesContent":["import { existsSync } from \"node:fs\"\n\nimport { list, task } from \"@adamhl8/bask\"\nimport bun, { $, Glob } from \"bun\"\n\nimport { resolveProjectTailwind } from \"#utils.ts\"\n\nconst inCi = Boolean(process.env[\"CI\"])\n\n/** Lists tracked and untracked files matching the pathspecs, skipping gitignored ones. */\nconst lsFiles = async (pathspecs: string[]) => {\n const output = await $`git ls-files -z --cached --others --exclude-standard -- ${pathspecs}`.quiet().text()\n return output.split(\"\\0\").filter(Boolean)\n}\n\n/** Checks that we're not in CI, the repo has a root tofu module, and the aws profile exists on this machine. */\nconst canRunTofu = async () => {\n if (inCi) return false\n const tofuFiles = await Array.fromAsync(new Glob(\"*.tofu\").scan())\n if (tofuFiles.length === 0) return false\n const profiles = await $`aws configure list-profiles`.nothrow().quiet().text()\n return profiles.split(\"\\n\").includes(\"adamhl8\")\n}\n\nexport const tofuCheck = task(async ({ sh }) => {\n if (await canRunTofu()) await sh`tofu plan -detailed-exitcode -concise -compact-warnings`\n})\n\nexport const prepare = task(async ({ sh }) => {\n // Skip `lefthook install` in CI so commits made by the workflows don't run the hooks.\n if (!inCi) await sh`lefthook install`\n await sh`adamhl8-gitignore`\n await sh`adamhl8-bunfig`\n await sh`adamhl8-tsconfig`\n await sh`oxfmt bunfig.toml`\n if (await canRunTofu()) await sh`tofu init -upgrade`\n})\n\nexport const bumpDeps = task(async ({ sh }) => {\n await sh`bunx npm-check-updates --upgrade --format group`\n await sh`rm -f bun.lock`\n await sh`rm -rf node_modules/`\n await sh`bun install --no-summary --no-cache`\n})\n\nexport const test = task(async ({ sh }) => {\n await sh`bun test --pass-with-no-tests`.echo(false)\n})\n\nexport const lint = task(async ({ sh }) => {\n await sh`markdown-toc -i --bullets - --maxdepth 3 ./README.md`\n await sh`oxlint --fix --fix-suggestions --fix-dangerously`\n await sh`oxfmt`\n\n if (resolveProjectTailwind()) {\n // Check for `.astro` files first so projects without them don't need tailwint installed.\n const astroFiles = await lsFiles([\":(glob)**/*.astro\"])\n // Skip `--fix` because tailwint resolves a class conflict by deleting a class by position, not by which one wins.\n if (astroFiles.length > 0) await sh`tailwint \"**/*.astro\"`\n }\n\n const tofuFiles = await lsFiles([\n \":(glob)**/*.tf\",\n \":(glob)**/*.tofu\",\n \":(glob)**/*.tfvars\",\n \":(glob)**/*.tftest.hcl\",\n \":(glob)**/*.tofutest.hcl\",\n ])\n if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`\n\n await sh`tsc`\n await sh`knip-bun`\n if (existsSync(\".github/workflows\")) await sh`actionlint`\n await test()\n})\n\nexport const build = task(async ({ sh }) => {\n await lint()\n if (await bun.file(\"tsdown.config.ts\").exists()) await sh`tsdown`\n // Fail in CI if the build changed or created any files, because lint fixes and formatting are applied in place.\n // `--intent-to-add` makes untracked files show up in the diff.\n if (inCi) {\n await sh`git add --intent-to-add --all`\n await sh`git diff --exit-code`\n }\n await tofuCheck()\n})\n\nexport const release = task(async ({ sh }) => {\n await sh`gh workflow run release.yml`\n})\n\nexport const releaseRun = task({ hidden: true }, async ({ sh }) => {\n await sh`release-it -VV --ci`\n})\n\nexport const commitTypes = task(async ({ sh }) => {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `commitlint --print-config json` prints\n const config = (await sh`commitlint --print-config json`.echo(false).json()) as {\n rules: { \"type-enum\": [number, string, string[]] }\n }\n const { 2: types } = config.rules[\"type-enum\"]\n console.log(`Commit types:\\n ${types.join(\"\\n \")}`)\n})\n\nlist.after(async () => {\n console.log()\n await commitTypes()\n})\n"],"mappings":";;;;;AAOA,MAAM,OAAO,QAAQ,QAAQ,IAAI,KAAK;;AAGtC,MAAM,UAAU,OAAO,cAAwB;CAE7C,QAAO,MADc,CAAC,2DAA2D,YAAY,MAAM,CAAC,CAAC,KAAK,EAAA,CAC5F,MAAM,IAAI,CAAC,CAAC,OAAO,OAAO;AAC1C;;AAGA,MAAM,aAAa,YAAY;CAC7B,IAAI,MAAM,OAAO;CAEjB,KAAI,MADoB,MAAM,UAAU,IAAI,KAAK,QAAQ,CAAC,CAAC,KA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G,MAAM,EAAE;CAGzD,IAAI,MAAM;EACR,MAAM,EAAE;EACR,MAAM,EAAE;CACV;CACA,MAAM,UAAU;AAClB,CAAC;AAED,MAAa,UAAU,KAAK,OAAO,EAAE,SAAS;CAC5C,MAAM,EAAE;AACV,CAAC;AAED,MAAa,aAAa,KAAK,EAAE,QAAQ,KAAK,GAAG,OAAO,EAAE,SAAS;CACjE,MAAM,EAAE;AACV,CAAC;AAED,MAAa,cAAc,KAAK,OAAO,EAAE,SAAS;CAKhD,MAAM,EAAE,GAAG,WAAU,MAHC,EAAE,iCAAiC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAA,CAG9C,MAAM;CAClC,QAAQ,IAAI,sBAAsB,MAAM,KAAK,QAAQ,GAAG;AAC1D,CAAC;AAED,KAAK,MAAM,YAAY;CACrB,QAAQ,IAAI;CACZ,MAAM,YAAY;AACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"commitlint.base.js","names":[],"sources":["../../src/configs/commitlint.base.ts"],"sourcesContent":["import conventional from \"@commitlint/config-conventional\"\nimport type { UserConfig } from \"@commitlint/types\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\nconst [_severity, _condition, conventionalTypes] = conventional.rules[\"type-enum\"]\n\nconst EXCLUDED_TYPES = new Set([\"test\", \"style\", \"build\"])\nconst filteredTypes = conventionalTypes.filter((type) => !EXCLUDED_TYPES.has(type))\nconst commitTypes = [...filteredTypes, \"improve\", \"release\"]\n\nconst baseConfig = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"type-enum\": [2, \"always\", commitTypes],\n },\n} as const satisfies UserConfig\n\nexport const commitlintConfig = createMergeConfigFn<UserConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAKA,MAAM,CAAC,WAAW,YAAY,qBAAqB,aAAa,MAAM;AAEtE,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAQ;CAAS;AAAO,CAAC;AAIzD,MAAM,aAAa;CACjB,SAAS,CAAC,iCAAiC;CAC3C,OAAO,EACL,aAAa;EAAC;EAAG;EAAU;GALV,GADC,kBAAkB,QAAQ,SAAS,CAAC,eAAe,IAAI,IAAI,CAC7C;GAAG;GAAW;EAKT;CAAC,EACxC;AACF;AAEA,MAAa,mBAAmB,oBAAmD,UAAU"}
1
+ {"version":3,"file":"commitlint.base.js","names":[],"sources":["../../src/configs/commitlint.base.ts"],"sourcesContent":["import conventional from \"@commitlint/config-conventional\"\nimport type { UserConfig } from \"@commitlint/types\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\nconst [_severity, _condition, conventionalTypes] = conventional.rules[\"type-enum\"]\n\nconst EXCLUDED_TYPES = new Set([\"test\", \"style\", \"build\"])\nconst filteredTypes = conventionalTypes.filter((type) => !EXCLUDED_TYPES.has(type))\nconst commitTypes = [...filteredTypes, \"improve\", \"release\"]\n\nconst baseConfig = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n // oxlint-disable-next-line typescript/no-unsafe-enum-assignment - use `2` because the enum leaks into consumer types\n \"type-enum\": [2, \"always\", commitTypes],\n },\n} as const satisfies UserConfig\n\nexport const commitlintConfig = createMergeConfigFn<UserConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAKA,MAAM,CAAC,WAAW,YAAY,qBAAqB,aAAa,MAAM;AAEtE,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAQ;CAAS;AAAO,CAAC;AAIzD,MAAM,aAAa;CACjB,SAAS,CAAC,iCAAiC;CAC3C,OAAO,EAEL,aAAa;EAAC;EAAG;EAAU;GANV,GADC,kBAAkB,QAAQ,SAAS,CAAC,eAAe,IAAI,IAAI,CAC7C;GAAG;GAAW;EAMT;CAAC,EACxC;AACF;AAEA,MAAa,mBAAmB,oBAAmD,UAAU"}
@@ -1,5 +1,4 @@
1
1
  node_modules/
2
2
  dist/
3
- /coverage/
4
3
  .terraform
5
4
  .terraform.lock.hcl
@@ -5,7 +5,7 @@ export declare const oxlintConfig: OptionalMergeConfigFn<OxlintConfig, {
5
5
  options: {
6
6
  readonly reportUnusedDisableDirectives: "error";
7
7
  readonly typeAware: true;
8
- readonly typeCheck: true;
8
+ readonly typeCheck: false;
9
9
  };
10
10
  categories: {
11
11
  readonly correctness: "error";
@@ -121,7 +121,7 @@ const nativeConfig = {
121
121
  options: {
122
122
  reportUnusedDisableDirectives: "error",
123
123
  typeAware: true,
124
- typeCheck: true
124
+ typeCheck: false
125
125
  },
126
126
  categories: {
127
127
  correctness: "error",
@@ -1 +1 @@
1
- {"version":3,"file":"oxlint.base.js","names":["directiveCommentsPluginRules","regexpPluginRules"],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import cleanModulesPlugin from \"@adamhl8/eslint-plugin-clean-modules\"\nimport e18ePlugin from \"@e18e/eslint-plugin\"\nimport bunismsPlugin from \"eslint-plugin-bunisms\"\nimport honoPlugin from \"eslint-plugin-hono\"\nimport reactWebApiPlugin from \"eslint-plugin-react-web-api\"\nimport reactEffectPlugin from \"eslint-plugin-react-you-might-not-need-an-effect\"\nimport { rules as regexpPluginRules } from \"eslint-plugin-regexp\"\nimport type { DummyRule, OxlintConfig, OxlintOverride } from \"oxlint\"\nimport { rules as directiveCommentsPluginRules } from \"oxlint-plugin-directive-comments\"\nimport tailwindcssPlugin from \"oxlint-tailwindcss\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from \"#utils.ts\"\n\n/** Sets every rule in a JS plugin to `severity`, because `categories` doesn't apply to JS plugins. */\nconst setAllPluginRules = (name: string, rules: Record<string, unknown>, severity: \"error\" | \"off\") =>\n Object.fromEntries(Object.keys(rules).map((rule) => [`${name}/${rule}`, severity] as const))\n\n// Type plugin rules with oxlint's generic `DummyRule` because its per-rule config types aren't exported, which breaks declaration emit.\ntype PluginRules = Record<string, DummyRule>\n\n/** A JS plugin and the slice of oxlint config that goes with it. Each one is merged into the base config. */\ninterface PluginPart extends Omit<OxlintConfig, \"jsPlugins\" | \"overrides\" | \"rules\"> {\n overrides?: (Omit<OxlintOverride, \"rules\"> & { rules?: PluginRules })[]\n rules?: PluginRules\n /** Loads the plugin only when true. Defaults to true. */\n enabled?: boolean\n package: string\n /** The plugin's rule definitions, used to set every rule to \"error\". The part's own `rules` then take precedence. */\n pluginRules: Record<string, unknown> | undefined\n}\n\nconst { dependencies, engines } = readProjectPackageJson()\nconst tailwindStylesheet = resolveProjectTailwind()\n\n// Key each part by the rule namespace its plugin registers.\nconst plugins: Record<string, PluginPart> = {\n bunisms: {\n overrides: [\n {\n excludeFiles: [\"src/**/__tests__/**\", \"src/**/*.test.{ts,tsx}\", \"src/**/test-setup.ts\", \"src/**/test-utils.ts\"],\n // Turn off Bun suggestions in Node runtime code. Tests and tooling still run on Bun.\n files: engines.has(\"node\") ? [\"src/**\"] : [],\n rules: setAllPluginRules(\"bunisms\", bunismsPlugin.rules, \"off\"),\n },\n ],\n package: \"eslint-plugin-bunisms\",\n pluginRules: bunismsPlugin.rules,\n rules: {\n \"bunisms/prefer-mock-restore-in-after-each\": \"off\", // `test-setup.ts` preloads restore mocks globally\n },\n },\n \"clean-modules\": {\n package: \"@adamhl8/eslint-plugin-clean-modules\",\n pluginRules: cleanModulesPlugin.rules,\n },\n \"directive-comments\": {\n package: \"oxlint-plugin-directive-comments\",\n pluginRules: directiveCommentsPluginRules,\n rules: {\n \"directive-comments/disable-enable-pair\": [\"error\", { allowWholeFile: true }],\n \"directive-comments/no-use\": \"off\", // bans every directive comment\n },\n },\n e18e: {\n package: \"@e18e/eslint-plugin\",\n pluginRules: e18ePlugin.rules,\n rules: {\n \"e18e/no-indexof-equality\": \"off\", // needs type information, which JS plugins don't get\n \"e18e/no-spread-in-reduce\": \"off\", // `oxc/no-accumulating-spread` covers this\n \"e18e/prefer-array-at\": \"off\", // `unicorn/prefer-at` covers this\n \"e18e/prefer-array-some\": \"off\", // `unicorn/prefer-array-some` covers this\n \"e18e/prefer-array-to-reversed\": \"off\", // `unicorn/no-array-reverse` covers this\n \"e18e/prefer-array-to-sorted\": \"off\", // `unicorn/no-array-sort` covers this\n \"e18e/prefer-date-now\": \"off\", // `unicorn/prefer-date-now` covers this\n \"e18e/prefer-exponentiation-operator\": \"off\", // `prefer-exponentiation-operator` covers this\n \"e18e/prefer-flatmap-over-map-flat\": \"off\", // `unicorn/prefer-array-flat-map` covers this\n \"e18e/prefer-includes\": \"off\", // `unicorn/prefer-includes` covers this\n \"e18e/prefer-nullish-coalescing\": \"off\", // `typescript/prefer-nullish-coalescing` covers this\n \"e18e/prefer-object-has-own\": \"off\", // `prefer-object-has-own` covers this\n \"e18e/prefer-slice-over-split-index\": \"off\",\n \"e18e/prefer-spread-syntax\": \"off\", // `unicorn/prefer-spread` and `prefer-object-spread` cover this\n },\n },\n hono: {\n enabled: dependencies.has(\"hono\"),\n package: \"eslint-plugin-hono\",\n pluginRules: honoPlugin.rules,\n rules: {\n \"hono/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n },\n },\n \"react-web-api\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-web-api\",\n pluginRules: reactWebApiPlugin.rules,\n },\n \"react-you-might-not-need-an-effect\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-you-might-not-need-an-effect\",\n pluginRules: reactEffectPlugin.rules,\n rules: {\n \"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-chain-state-updates\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-derived-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-initialize-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n },\n },\n regexp: {\n package: \"eslint-plugin-regexp\",\n pluginRules: regexpPluginRules,\n rules: {\n \"regexp/letter-case\": [\"error\", { hexadecimalEscape: \"uppercase\", unicodeEscape: \"uppercase\" }], // match `unicorn/escape-case`\n \"regexp/no-control-character\": \"off\", // `no-control-regex` covers this\n \"regexp/no-empty-character-class\": \"off\", // `no-empty-character-class` covers this\n \"regexp/no-invalid-regexp\": \"off\", // `no-invalid-regexp` covers this\n \"regexp/no-super-linear-move\": \"off\",\n \"regexp/no-useless-escape\": \"off\", // `no-useless-escape` covers this\n \"regexp/prefer-named-capture-group\": \"off\", // `prefer-named-capture-group` covers this\n \"regexp/require-unicode-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/require-unicode-sets-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/sort-alternatives\": \"off\",\n },\n },\n tailwindcss: {\n // Load the Tailwind plugin only with a stylesheet because it reports every class string without one.\n enabled: Boolean(tailwindStylesheet),\n package: \"oxlint-tailwindcss\",\n pluginRules: tailwindcssPlugin.rules,\n rules: {\n \"tailwindcss/enforce-consistent-line-wrapping\": \"off\", // oxfmt handles line width\n \"tailwindcss/enforce-logical\": \"off\", // conflicts with `tailwindcss/enforce-physical`\n \"tailwindcss/enforce-sort-order\": \"off\", // oxfmt sorts classes\n \"tailwindcss/max-class-count\": \"off\",\n },\n // Keep `entryPoint` relative because the plugin resolves it against the directory of the project's oxlint config.\n settings: { tailwindcss: { entryPoint: tailwindStylesheet } },\n },\n}\n\nconst nativeConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n typeCheck: true,\n },\n\n categories: {\n correctness: \"error\",\n nursery: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n restriction: \"error\",\n style: \"error\",\n suspicious: \"error\",\n },\n\n plugins: [\n \"eslint\",\n \"react\",\n \"unicorn\",\n \"typescript\",\n \"oxc\",\n \"import\",\n \"jsdoc\",\n \"vitest\",\n \"jsx-a11y\",\n \"react-perf\",\n \"promise\",\n \"node\",\n ],\n\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\"bask.ts\"],\n rules: {\n \"clean-modules/require-direct-exports\": \"off\",\n \"import/export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"declaration\", { allowArrowFunctions: true }],\n },\n },\n {\n files: [\"**/fixtures/**\", \"**/fixture/**\"],\n rules: {\n \"clean-modules/require-import-extensions\": \"off\",\n \"clean-modules/require-subpath-imports\": \"off\",\n \"import/no-default-export\": \"off\",\n },\n },\n ],\n\n rules: {\n /* Modified rules */\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n\n \"react/function-component-definition\": [\n \"error\",\n { namedComponents: \"function-declaration\", unnamedComponents: \"arrow-function\" },\n ],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n /* Disabled rules */\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"init-declarations\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"off\",\n \"no-console\": \"off\",\n \"no-continue\": \"off\",\n \"no-duplicate-imports\": \"off\",\n \"no-inline-comments\": \"off\",\n \"no-magic-numbers\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-regex-spaces\": \"off\", // `regexp/prefer-quantifier` covers this\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"one-var\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n\n \"node/callback-return\": \"off\",\n \"node/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n\n \"react/exhaustive-effect-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/forbid-component-props\": \"off\",\n \"react/hooks\": \"off\", // `react/rules-of-hooks` covers this\n \"react/invariant\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/memo-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/no-deriving-state-in-effects\": \"off\", // `react/set-state-in-effect` covers this\n \"react/react-in-jsx-scope\": \"off\",\n \"react/rule-suppression\": \"off\",\n \"react/todo\": \"off\",\n\n \"typescript/consistent-return\": \"off\",\n \"typescript/explicit-function-return-type\": \"off\",\n \"typescript/explicit-module-boundary-types\": \"off\",\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"typescript/strict-boolean-expressions\": \"off\",\n\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-importing-vitest-globals\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nconst enabledPluginEntries = Object.entries(plugins).filter(([, plugin]) => plugin.enabled ?? true)\nconst enabledPlugins = enabledPluginEntries.map(([, plugin]) => plugin)\n// Resolve JS plugins to absolute paths so consumers load them from this package's own deps.\nconst resolvedPluginPackages = enabledPlugins.map((plugin) => resolvePackagePath(plugin.package))\nconst pluginOverrides = enabledPlugins.flatMap((plugin) => plugin.overrides ?? [])\nconst pluginSettings = Object.fromEntries(enabledPlugins.flatMap((plugin) => Object.entries(plugin.settings ?? {})))\n\n/** Lists a plugin's rules as entries */\nconst toPluginRuleEntries = ([name, { pluginRules = {}, rules }]: [string, PluginPart]) => {\n const defaultRules = setAllPluginRules(name, pluginRules, \"error\")\n const pluginRuleEntries = Object.entries({ ...defaultRules, ...rules })\n return pluginRuleEntries\n}\n\nconst resolvedPluginRules = Object.fromEntries(enabledPluginEntries.flatMap(toPluginRuleEntries))\n\nconst baseConfig = {\n ...nativeConfig,\n jsPlugins: resolvedPluginPackages,\n overrides: [...nativeConfig.overrides, ...pluginOverrides],\n rules: {\n ...resolvedPluginRules,\n ...nativeConfig.rules,\n },\n settings: pluginSettings,\n} satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,qBAAqB,MAAc,OAAgC,aACvE,OAAO,YAAY,OAAO,KAAK,KAAK,CAAC,CAAC,KAAK,SA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,yCAAyC;EACzC,mCAAmC;EACnC,0CAA0C;EAC1C,iCAAiC;EACjC,6BAA6B;EAC7B,8BAA8B;EAC9B,uBAAuB;EACvB,+BAA+B;CACjC;AACF;AAEA,MAAM,uBAAuB,OAAO,QAAQ,OAAO,CAAC,CAAC,QAAQ,GAAG,YAAY,OAAO,WAAW,IAAI;AAClG,MAAM,iBAAiB,qBAAqB,KAAK,GAAG,YAAY,MAAM;AAEtE,MAAM,yBAAyB,eAAe,KAAK,WAAW,mBAAmB,OAAO,OAAO,CAAC;AAChG,MAAM,kBAAkB,eAAe,SAAS,WAAW,OAAO,aAAa,CAAC,CAAC;AACjF,MAAM,iBAAiB,OAAO,YAAY,eAAe,SAAS,WAAW,OAAO,QAAQ,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;;AAGnH,MAAM,uBAAuB,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,aAAmC;CACzF,MAAM,eAAe,kBAAkB,MAAM,aAAa,OAAO;CAEjE,OAD0B,OAAO,QAAQ;EAAE,GAAG;EAAc,GAAG;CAAM,CAC9C;AACzB;AAEA,MAAM,sBAAsB,OAAO,YAAY,qBAAqB,QAAQ,mBAAmB,CAAC;AAEhG,MAAM,aAAa;CACjB,GAAG;CACH,WAAW;CACX,WAAW,CAAC,GAAG,aAAa,WAAW,GAAG,eAAe;CACzD,OAAO;EACL,GAAG;EACH,GAAG,aAAa;CAClB;CACA,UAAU;AACZ;AAEA,MAAa,eAAe,oBAAqD,UAAU"}
1
+ {"version":3,"file":"oxlint.base.js","names":["directiveCommentsPluginRules","regexpPluginRules"],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import cleanModulesPlugin from \"@adamhl8/eslint-plugin-clean-modules\"\nimport e18ePlugin from \"@e18e/eslint-plugin\"\nimport bunismsPlugin from \"eslint-plugin-bunisms\"\nimport honoPlugin from \"eslint-plugin-hono\"\nimport reactWebApiPlugin from \"eslint-plugin-react-web-api\"\nimport reactEffectPlugin from \"eslint-plugin-react-you-might-not-need-an-effect\"\nimport { rules as regexpPluginRules } from \"eslint-plugin-regexp\"\nimport type { DummyRule, OxlintConfig, OxlintOverride } from \"oxlint\"\nimport { rules as directiveCommentsPluginRules } from \"oxlint-plugin-directive-comments\"\nimport tailwindcssPlugin from \"oxlint-tailwindcss\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from \"#utils.ts\"\n\n/** Sets every rule in a JS plugin to `severity`, because `categories` doesn't apply to JS plugins. */\nconst setAllPluginRules = (name: string, rules: Record<string, unknown>, severity: \"error\" | \"off\") =>\n Object.fromEntries(Object.keys(rules).map((rule) => [`${name}/${rule}`, severity] as const))\n\n// Type plugin rules with oxlint's generic `DummyRule` because its per-rule config types aren't exported, which breaks declaration emit.\ntype PluginRules = Record<string, DummyRule>\n\n/** A JS plugin and the slice of oxlint config that goes with it. Each one is merged into the base config. */\ninterface PluginPart extends Omit<OxlintConfig, \"jsPlugins\" | \"overrides\" | \"rules\"> {\n overrides?: (Omit<OxlintOverride, \"rules\"> & { rules?: PluginRules })[]\n rules?: PluginRules\n /** Loads the plugin only when true. Defaults to true. */\n enabled?: boolean\n package: string\n /** The plugin's rule definitions, used to set every rule to \"error\". The part's own `rules` then take precedence. */\n pluginRules: Record<string, unknown> | undefined\n}\n\nconst { dependencies, engines } = readProjectPackageJson()\nconst tailwindStylesheet = resolveProjectTailwind()\n\n// Key each part by the rule namespace its plugin registers.\nconst plugins: Record<string, PluginPart> = {\n bunisms: {\n overrides: [\n {\n excludeFiles: [\"src/**/__tests__/**\", \"src/**/*.test.{ts,tsx}\", \"src/**/test-setup.ts\", \"src/**/test-utils.ts\"],\n // Turn off Bun suggestions in Node runtime code. Tests and tooling still run on Bun.\n files: engines.has(\"node\") ? [\"src/**\"] : [],\n rules: setAllPluginRules(\"bunisms\", bunismsPlugin.rules, \"off\"),\n },\n ],\n package: \"eslint-plugin-bunisms\",\n pluginRules: bunismsPlugin.rules,\n rules: {\n \"bunisms/prefer-mock-restore-in-after-each\": \"off\", // `test-setup.ts` preloads restore mocks globally\n },\n },\n \"clean-modules\": {\n package: \"@adamhl8/eslint-plugin-clean-modules\",\n pluginRules: cleanModulesPlugin.rules,\n },\n \"directive-comments\": {\n package: \"oxlint-plugin-directive-comments\",\n pluginRules: directiveCommentsPluginRules,\n rules: {\n \"directive-comments/disable-enable-pair\": [\"error\", { allowWholeFile: true }],\n \"directive-comments/no-use\": \"off\", // bans every directive comment\n },\n },\n e18e: {\n package: \"@e18e/eslint-plugin\",\n pluginRules: e18ePlugin.rules,\n rules: {\n \"e18e/no-indexof-equality\": \"off\", // needs type information, which JS plugins don't get\n \"e18e/no-spread-in-reduce\": \"off\", // `oxc/no-accumulating-spread` covers this\n \"e18e/prefer-array-at\": \"off\", // `unicorn/prefer-at` covers this\n \"e18e/prefer-array-some\": \"off\", // `unicorn/prefer-array-some` covers this\n \"e18e/prefer-array-to-reversed\": \"off\", // `unicorn/no-array-reverse` covers this\n \"e18e/prefer-array-to-sorted\": \"off\", // `unicorn/no-array-sort` covers this\n \"e18e/prefer-date-now\": \"off\", // `unicorn/prefer-date-now` covers this\n \"e18e/prefer-exponentiation-operator\": \"off\", // `prefer-exponentiation-operator` covers this\n \"e18e/prefer-flatmap-over-map-flat\": \"off\", // `unicorn/prefer-array-flat-map` covers this\n \"e18e/prefer-includes\": \"off\", // `unicorn/prefer-includes` covers this\n \"e18e/prefer-nullish-coalescing\": \"off\", // `typescript/prefer-nullish-coalescing` covers this\n \"e18e/prefer-object-has-own\": \"off\", // `prefer-object-has-own` covers this\n \"e18e/prefer-slice-over-split-index\": \"off\",\n \"e18e/prefer-spread-syntax\": \"off\", // `unicorn/prefer-spread` and `prefer-object-spread` cover this\n },\n },\n hono: {\n enabled: dependencies.has(\"hono\"),\n package: \"eslint-plugin-hono\",\n pluginRules: honoPlugin.rules,\n rules: {\n \"hono/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n },\n },\n \"react-web-api\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-web-api\",\n pluginRules: reactWebApiPlugin.rules,\n },\n \"react-you-might-not-need-an-effect\": {\n enabled: dependencies.has(\"react\"),\n package: \"eslint-plugin-react-you-might-not-need-an-effect\",\n pluginRules: reactEffectPlugin.rules,\n rules: {\n \"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-chain-state-updates\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-derived-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-initialize-state\": \"off\", // `react/set-state-in-effect` covers this\n \"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change\": \"off\", // `react/set-state-in-effect` covers this\n },\n },\n regexp: {\n package: \"eslint-plugin-regexp\",\n pluginRules: regexpPluginRules,\n rules: {\n \"regexp/letter-case\": [\"error\", { hexadecimalEscape: \"uppercase\", unicodeEscape: \"uppercase\" }], // match `unicorn/escape-case`\n \"regexp/no-control-character\": \"off\", // `no-control-regex` covers this\n \"regexp/no-empty-character-class\": \"off\", // `no-empty-character-class` covers this\n \"regexp/no-invalid-regexp\": \"off\", // `no-invalid-regexp` covers this\n \"regexp/no-super-linear-move\": \"off\",\n \"regexp/no-useless-escape\": \"off\", // `no-useless-escape` covers this\n \"regexp/prefer-named-capture-group\": \"off\", // `prefer-named-capture-group` covers this\n \"regexp/require-unicode-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/require-unicode-sets-regexp\": \"off\", // `require-unicode-regexp` covers this\n \"regexp/sort-alternatives\": \"off\",\n },\n },\n tailwindcss: {\n // Load the Tailwind plugin only with a stylesheet because it reports every class string without one.\n enabled: Boolean(tailwindStylesheet),\n package: \"oxlint-tailwindcss\",\n pluginRules: tailwindcssPlugin.rules,\n rules: {\n \"tailwindcss/enforce-consistent-line-wrapping\": \"off\", // oxfmt handles line width\n \"tailwindcss/enforce-logical\": \"off\", // conflicts with `tailwindcss/enforce-physical`\n \"tailwindcss/enforce-sort-order\": \"off\", // oxfmt sorts classes\n \"tailwindcss/max-class-count\": \"off\",\n },\n // Keep `entryPoint` relative because the plugin resolves it against the directory of the project's oxlint config.\n settings: { tailwindcss: { entryPoint: tailwindStylesheet } },\n },\n}\n\nconst nativeConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n // Leave `typeCheck` off because `bask lint` runs `tsc`, which also reports declaration errors.\n typeCheck: false,\n },\n\n categories: {\n correctness: \"error\",\n nursery: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n restriction: \"error\",\n style: \"error\",\n suspicious: \"error\",\n },\n\n plugins: [\n \"eslint\",\n \"react\",\n \"unicorn\",\n \"typescript\",\n \"oxc\",\n \"import\",\n \"jsdoc\",\n \"vitest\",\n \"jsx-a11y\",\n \"react-perf\",\n \"promise\",\n \"node\",\n ],\n\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\"bask.ts\"],\n rules: {\n \"clean-modules/require-direct-exports\": \"off\",\n \"import/export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"declaration\", { allowArrowFunctions: true }],\n },\n },\n {\n files: [\"**/fixtures/**\", \"**/fixture/**\"],\n rules: {\n \"clean-modules/require-import-extensions\": \"off\",\n \"clean-modules/require-subpath-imports\": \"off\",\n \"import/no-default-export\": \"off\",\n },\n },\n ],\n\n rules: {\n /* Modified rules */\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n\n \"react/function-component-definition\": [\n \"error\",\n { namedComponents: \"function-declaration\", unnamedComponents: \"arrow-function\" },\n ],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n /* Disabled rules */\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"init-declarations\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"off\",\n \"no-console\": \"off\",\n \"no-continue\": \"off\",\n \"no-duplicate-imports\": \"off\",\n \"no-inline-comments\": \"off\",\n \"no-magic-numbers\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-regex-spaces\": \"off\", // `regexp/prefer-quantifier` covers this\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"one-var\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n\n \"node/callback-return\": \"off\",\n \"node/no-process-env\": \"off\", // tools and tests legitimately read the raw environment\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n\n \"react/exhaustive-effect-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/forbid-component-props\": \"off\",\n \"react/hooks\": \"off\", // `react/rules-of-hooks` covers this\n \"react/invariant\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/memo-dependencies\": \"off\", // `react/exhaustive-deps` covers this\n \"react/no-deriving-state-in-effects\": \"off\", // `react/set-state-in-effect` covers this\n \"react/react-in-jsx-scope\": \"off\",\n \"react/rule-suppression\": \"off\",\n \"react/todo\": \"off\",\n\n \"typescript/consistent-return\": \"off\",\n \"typescript/explicit-function-return-type\": \"off\",\n \"typescript/explicit-module-boundary-types\": \"off\",\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"typescript/strict-boolean-expressions\": \"off\",\n\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-importing-vitest-globals\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nconst enabledPluginEntries = Object.entries(plugins).filter(([, plugin]) => plugin.enabled ?? true)\nconst enabledPlugins = enabledPluginEntries.map(([, plugin]) => plugin)\n// Resolve JS plugins to absolute paths so consumers load them from this package's own deps.\nconst resolvedPluginPackages = enabledPlugins.map((plugin) => resolvePackagePath(plugin.package))\nconst pluginOverrides = enabledPlugins.flatMap((plugin) => plugin.overrides ?? [])\nconst pluginSettings = Object.fromEntries(enabledPlugins.flatMap((plugin) => Object.entries(plugin.settings ?? {})))\n\n/** Lists a plugin's rules as entries */\nconst toPluginRuleEntries = ([name, { pluginRules = {}, rules }]: [string, PluginPart]) => {\n const defaultRules = setAllPluginRules(name, pluginRules, \"error\")\n const pluginRuleEntries = Object.entries({ ...defaultRules, ...rules })\n return pluginRuleEntries\n}\n\nconst resolvedPluginRules = Object.fromEntries(enabledPluginEntries.flatMap(toPluginRuleEntries))\n\nconst baseConfig = {\n ...nativeConfig,\n jsPlugins: resolvedPluginPackages,\n overrides: [...nativeConfig.overrides, ...pluginOverrides],\n rules: {\n ...resolvedPluginRules,\n ...nativeConfig.rules,\n },\n settings: pluginSettings,\n} satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,qBAAqB,MAAc,OAAgC,aACvE,OAAO,YAAY,OAAO,KAAK,KAAK,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,KAAK,GAAG,QAAQ,QAAQ,CAAU,CAAC;AAgB7F,MAAM,EAAE,cAAc,YAAY,uBAAuB;AACzD,MAAM,qBAAqB,uBAAuB;AAGlD,MAAM,UAAsC;CAC1C,SAAS;EACP,WAAW,CACT;GACE,cAAc;IAAC;IAAuB;IAA0B;IAAwB;GAAsB;GAE9G,OAAO,QAAQ,IAAI,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC;GAC3C,OAAO,kBAAkB,WAAW,cAAc,OAAO,KAAK;EAChE,CACF;EACA,SAAS;EACT,aAAa,cAAc;EAC3B,OAAO,EACL,6CAA6C,MAC/C;CACF;CACA,iBAAiB;EACf,SAAS;EACT,aAAa,mBAAmB;CAClC;CACA,sBAAsB;EACpB,SAAS;EACT,aAAaA;EACb,OAAO;GACL,0CAA0C,CAAC,SAAS,EAAE,gBAAgB,KAAK,CAAC;GAC5E,6BAA6B;EAC/B;CACF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kBAAkB,MAAM,aAAa,OAAO;CAEjE,OAD0B,OAAO,QAAQ;EAAE,GAAG;EAAc,GAAG;CAAM,CAC9C;AACzB;AAEA,MAAM,sBAAsB,OAAO,YAAY,qBAAqB,QAAQ,mBAAmB,CAAC;AAEhG,MAAM,aAAa;CACjB,GAAG;CACH,WAAW;CACX,WAAW,CAAC,GAAG,aAAa,WAAW,GAAG,eAAe;CACzD,OAAO;EACL,GAAG;EACH,GAAG,aAAa;CAClB;CACA,UAAU;AACZ;AAEA,MAAa,eAAe,oBAAqD,UAAU"}
@@ -18,7 +18,6 @@
18
18
  "skipLibCheck": true,
19
19
  "noEmit": true,
20
20
  "declaration": true,
21
- "declarationMap": true,
22
21
 
23
22
  "allowUnreachableCode": false,
24
23
  "allowUnusedLabels": false,
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.json",
4
+ "compilerOptions": {
5
+ "declaration": false
6
+ }
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\n// Force projects to specify platform\ntype StrictConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n platform: \"neutral\",\n target: false,\n unbundle: true,\n sourcemap: true,\n minify: \"dce-only\",\n fixedExtension: false,\n hash: false,\n dts: {\n generator: \"tsgo\",\n },\n deps: {\n neverBundle: [\"bun\"],\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n suppressWarnings: [\"TypeScript Go is experimental\"],\n} as const satisfies StrictConfig\n\n// Force projects to specify platform and entry\ntype StrictBundleConfig = SetRequired<UserConfig, \"platform\" | \"entry\">\n\n// Single-file bundle (not a published library): bundle everything, drop types/lint/sourcemap.\nconst bundleConfig = {\n ...baseConfig,\n entry: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n inputOptions: {\n experimental: {\n attachDebugInfo: \"none\", // remove region comments from bundled output\n },\n },\n} as const satisfies StrictBundleConfig\n\n// Force projects to specify platform and entry\ntype StrictBinConfig = SetRequired<UserConfig, \"entry\">\n\n// A bin is a node bundle with no output file extension.\nconst binConfig = {\n ...bundleConfig,\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }) as const,\n} as const satisfies StrictBinConfig\n\n// The export annotations forbid the no-arg call (platform/entry must be provided) and are load-bearing for\n// declaration emit: without one, tsgo synthesizes the type and fails with TS2883 on tsdown's non-exported internals.\nexport const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig> = createMergeConfigFn<\n StrictConfig,\n typeof baseConfig\n>(baseConfig)\n\nexport const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig> = createMergeConfigFn<\n StrictBundleConfig,\n typeof bundleConfig\n>(bundleConfig)\n\nexport const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig> = createMergeConfigFn<\n StrictBinConfig,\n typeof binConfig\n>(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,OAAO,CAAC,gBAAgB;CACxB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,WAAW;CACX,QAAQ;CACR,gBAAgB;CAChB,MAAM;CACN,KAAK,EACH,WAAW,OACb;CACA,MAAM,EACJ,aAAa,CAAC,KAAK,EACrB;CACA,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,SAAS;CACT,YAAY;CACZ,kBAAkB,CAAC,+BAA+B;AACpD;AAMA,MAAM,eAAe;CACnB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACT,cAAc,EACZ,cAAc,EACZ,iBAAiB,OACnB,EACF;AACF;AAMA,MAAM,YAAY;CAChB,GAAG;CACH,UAAU;CACV,sBAAsB,EAAE,IAAI,GAAG;AACjC;AAIA,MAAa,eAA+D,oBAG1E,UAAU;AAEZ,MAAa,qBAA6E,oBAGxF,YAAY;AAEd,MAAa,kBAAoE,oBAG/E,SAAS"}
1
+ {"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\n// Force projects to specify platform\ntype StrictConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n platform: \"neutral\",\n target: false,\n unbundle: true,\n sourcemap: true,\n minify: \"dce-only\",\n fixedExtension: false,\n hash: false,\n dts: {\n generator: \"tsgo\",\n },\n deps: {\n neverBundle: [\"bun\"],\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n suppressWarnings: [\"TypeScript Go is experimental\"],\n} as const satisfies StrictConfig\n\n// Force projects to specify platform and entry\ntype StrictBundleConfig = SetRequired<UserConfig, \"platform\" | \"entry\">\n\n// Single-file bundle (not a published library): bundle everything, drop types/lint/sourcemap.\nconst bundleConfig = {\n ...baseConfig,\n entry: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n inputOptions: {\n experimental: {\n attachDebugInfo: \"none\", // remove region comments from bundled output\n },\n },\n} as const satisfies StrictBundleConfig\n\n// Force projects to specify platform and entry\ntype StrictBinConfig = SetRequired<UserConfig, \"entry\">\n\n// A bin is a node bundle with no output file extension.\nconst binConfig = {\n ...bundleConfig,\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }) as const,\n} as const satisfies StrictBinConfig\n\n// The export annotations forbid the no-arg call because `platform` and `entry` must be provided.\n// They also keep the published types correct.\n// Without one, `tsc` fails with TS2883 on tsdown's non-exported internals and the build silently emits `any`.\nexport const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig> = createMergeConfigFn<\n StrictConfig,\n typeof baseConfig\n>(baseConfig)\n\nexport const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig> = createMergeConfigFn<\n StrictBundleConfig,\n typeof bundleConfig\n>(bundleConfig)\n\nexport const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig> = createMergeConfigFn<\n StrictBinConfig,\n typeof binConfig\n>(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,OAAO,CAAC,gBAAgB;CACxB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,WAAW;CACX,QAAQ;CACR,gBAAgB;CAChB,MAAM;CACN,KAAK,EACH,WAAW,OACb;CACA,MAAM,EACJ,aAAa,CAAC,KAAK,EACrB;CACA,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,SAAS;CACT,YAAY;CACZ,kBAAkB,CAAC,+BAA+B;AACpD;AAMA,MAAM,eAAe;CACnB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACT,cAAc,EACZ,cAAc,EACZ,iBAAiB,OACnB,EACF;AACF;AAMA,MAAM,YAAY;CAChB,GAAG;CACH,UAAU;CACV,sBAAsB,EAAE,IAAI,GAAG;AACjC;AAKA,MAAa,eAA+D,oBAG1E,UAAU;AAEZ,MAAa,qBAA6E,oBAGxF,YAAY;AAEd,MAAa,kBAAoE,oBAG/E,SAAS"}
@@ -1,16 +1,10 @@
1
1
  import { Shell, ShellOptions } from "./shell/shell.js";
2
2
  export interface CopyFixtureOptions {
3
- /**
4
- * The start of the temp dir's name.
5
- *
6
- * @default `${path.basename(fixture)}-`
7
- */
8
- prefix?: string;
9
3
  /** Options for the returned shell, which always runs in the copy. */
10
4
  shell?: Omit<ShellOptions, "cwd">;
11
5
  }
12
6
  /** Copies `fixture` into a new temp dir, and returns the dir and a shell that runs there. */
13
- export declare const copyFixture: (fixture: string, { prefix, shell }?: CopyFixtureOptions) => Promise<{
7
+ export declare const copyFixture: (fixture: string, { shell }?: CopyFixtureOptions) => Promise<{
14
8
  dir: string;
15
9
  run: Shell;
16
10
  }>;
@@ -1,11 +1,10 @@
1
1
  import { createShell } from "./shell/shell.js";
2
2
  import { makeTempDir } from "./temp-dir.js";
3
3
  import fs from "node:fs/promises";
4
- import path from "node:path";
5
4
  // src/test-utils/fixture.ts
6
5
  /** Copies `fixture` into a new temp dir, and returns the dir and a shell that runs there. */
7
- const copyFixture = async (fixture, { prefix, shell } = {}) => {
8
- const dir = await makeTempDir(prefix ?? `${path.basename(fixture)}-`);
6
+ const copyFixture = async (fixture, { shell } = {}) => {
7
+ const dir = await makeTempDir();
9
8
  await fs.cp(fixture, dir, { recursive: true });
10
9
  return {
11
10
  dir,
@@ -1 +1 @@
1
- {"version":3,"file":"fixture.js","names":[],"sources":["../../src/test-utils/fixture.ts"],"sourcesContent":["import fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport { createShell } from \"#test-utils/shell/shell.ts\"\nimport type { ShellOptions } from \"#test-utils/shell/shell.ts\"\nimport { makeTempDir } from \"#test-utils/temp-dir.ts\"\n\nexport interface CopyFixtureOptions {\n /**\n * The start of the temp dir's name.\n *\n * @default `${path.basename(fixture)}-`\n */\n prefix?: string\n /** Options for the returned shell, which always runs in the copy. */\n shell?: Omit<ShellOptions, \"cwd\">\n}\n\n/** Copies `fixture` into a new temp dir, and returns the dir and a shell that runs there. */\nexport const copyFixture = async (fixture: string, { prefix, shell }: CopyFixtureOptions = {}) => {\n const dir = await makeTempDir(prefix ?? `${path.basename(fixture)}-`)\n await fs.cp(fixture, dir, { recursive: true })\n const run = createShell({ ...shell, cwd: dir })\n return { dir, run }\n}\n"],"mappings":";;;;;;AAmBA,MAAa,cAAc,OAAO,SAAiB,EAAE,QAAQ,UAA8B,CAAC,MAAM;CAChG,MAAM,MAAM,MAAM,YAAY,UAAU,GAAG,KAAK,SAAS,OAAO,EAAE,EAAE;CACpE,MAAM,GAAG,GAAG,SAAS,KAAK,EAAE,WAAW,KAAK,CAAC;CAE7C,OAAO;EAAE;EAAK,KADF,YAAY;GAAE,GAAG;GAAO,KAAK;EAAI,CAC7B;CAAE;AACpB"}
1
+ {"version":3,"file":"fixture.js","names":[],"sources":["../../src/test-utils/fixture.ts"],"sourcesContent":["import fs from \"node:fs/promises\"\n\nimport { createShell } from \"#test-utils/shell/shell.ts\"\nimport type { ShellOptions } from \"#test-utils/shell/shell.ts\"\nimport { makeTempDir } from \"#test-utils/temp-dir.ts\"\n\nexport interface CopyFixtureOptions {\n /** Options for the returned shell, which always runs in the copy. */\n shell?: Omit<ShellOptions, \"cwd\">\n}\n\n/** Copies `fixture` into a new temp dir, and returns the dir and a shell that runs there. */\nexport const copyFixture = async (fixture: string, { shell }: CopyFixtureOptions = {}) => {\n const dir = await makeTempDir()\n await fs.cp(fixture, dir, { recursive: true })\n const run = createShell({ ...shell, cwd: dir })\n return { dir, run }\n}\n"],"mappings":";;;;;AAYA,MAAa,cAAc,OAAO,SAAiB,EAAE,UAA8B,CAAC,MAAM;CACxF,MAAM,MAAM,MAAM,YAAY;CAC9B,MAAM,GAAG,GAAG,SAAS,KAAK,EAAE,WAAW,KAAK,CAAC;CAE7C,OAAO;EAAE;EAAK,KADF,YAAY;GAAE,GAAG;GAAO,KAAK;EAAI,CAC7B;CAAE;AACpB"}
@@ -1,8 +1,7 @@
1
- import { ShellCommand } from "./shell/command.js";
2
- import { Shell, ShellEnv, ShellOptions, ShellResult, createShell } from "./shell/shell.js";
3
1
  import { minimalEnv } from "./shell/env.js";
4
2
  import { CopyFixtureOptions, copyFixture } from "./fixture.js";
5
3
  import { packPackage } from "./pack.js";
6
- import { subprocessCoverageEnv } from "./subprocess-coverage/env.js";
4
+ import { ShellCommand } from "./shell/command.js";
5
+ import { Shell, ShellEnv, ShellOptions, ShellResult, createShell } from "./shell/shell.js";
7
6
  import { makeTempDir } from "./temp-dir.js";
8
- export { type CopyFixtureOptions, type Shell, type ShellCommand, type ShellEnv, type ShellOptions, type ShellResult, copyFixture, createShell, makeTempDir, minimalEnv, packPackage, subprocessCoverageEnv };
7
+ export { type CopyFixtureOptions, type Shell, type ShellCommand, type ShellEnv, type ShellOptions, type ShellResult, copyFixture, createShell, makeTempDir, minimalEnv, packPackage };
@@ -1,7 +1,6 @@
1
1
  import { minimalEnv } from "./shell/env.js";
2
- import { createShell } from "./shell/shell.js";
3
- import { makeTempDir } from "./temp-dir.js";
4
2
  import { copyFixture } from "./fixture.js";
5
3
  import { packPackage } from "./pack.js";
6
- import { subprocessCoverageEnv } from "./subprocess-coverage/env.js";
7
- export { copyFixture, createShell, makeTempDir, minimalEnv, packPackage, subprocessCoverageEnv };
4
+ import { createShell } from "./shell/shell.js";
5
+ import { makeTempDir } from "./temp-dir.js";
6
+ export { copyFixture, createShell, makeTempDir, minimalEnv, packPackage };
@@ -1,3 +1,6 @@
1
- /** Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path. */
1
+ /**
2
+ * Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path.
3
+ * Runs once per resolved root for the life of the test process.
4
+ */
2
5
  export declare const packPackage: (root: string) => Promise<string>;
3
6
  //# sourceMappingURL=pack.d.ts.map
@@ -1,16 +1,28 @@
1
1
  import { createShell } from "./shell/shell.js";
2
2
  import { makeTempDir } from "./temp-dir.js";
3
- import path from "node:path";
4
3
  import bun from "bun";
4
+ import path from "node:path";
5
5
  // src/test-utils/pack.ts
6
- /** Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path. */
7
- const packPackage = async (root) => {
6
+ const packs = /* @__PURE__ */ new Map();
7
+ const buildAndPack = async (root) => {
8
8
  const run = createShell({ cwd: root });
9
9
  if (await bun.file(path.join(root, "tsdown.config.ts")).exists()) await run`bun tsdown`;
10
- const destination = await makeTempDir(`${path.basename(root)}-pack-`);
10
+ const destination = await makeTempDir();
11
11
  const { stdout } = await run`bun pm pack --ignore-scripts --quiet --destination ${destination}`;
12
12
  return path.resolve(destination, stdout);
13
13
  };
14
+ /**
15
+ * Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path.
16
+ * Runs once per resolved root for the life of the test process.
17
+ */
18
+ const packPackage = async (root) => {
19
+ const resolvedRoot = path.resolve(root);
20
+ const existingPack = packs.get(resolvedRoot);
21
+ if (existingPack) return existingPack;
22
+ const pack = buildAndPack(resolvedRoot);
23
+ packs.set(resolvedRoot, pack);
24
+ return pack;
25
+ };
14
26
  export { packPackage };
15
27
 
16
28
  //# sourceMappingURL=pack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pack.js","names":[],"sources":["../../src/test-utils/pack.ts"],"sourcesContent":["import path from \"node:path\"\n\nimport bun from \"bun\"\n\nimport { createShell } from \"#test-utils/shell/shell.ts\"\nimport { makeTempDir } from \"#test-utils/temp-dir.ts\"\n\n/** Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path. */\nexport const packPackage = async (root: string) => {\n const run = createShell({ cwd: root })\n if (await bun.file(path.join(root, \"tsdown.config.ts\")).exists()) await run`bun tsdown`\n\n const destination = await makeTempDir(`${path.basename(root)}-pack-`)\n // Skip lifecycle scripts because a `prepare` script would rebuild and run the package's own tasks.\n const { stdout } = await run`bun pm pack --ignore-scripts --quiet --destination ${destination}`\n return path.resolve(destination, stdout)\n}\n"],"mappings":";;;;;;AAQA,MAAa,cAAc,OAAO,SAAiB;CACjD,MAAM,MAAM,YAAY,EAAE,KAAK,KAAK,CAAC;CACrC,IAAI,MAAM,IAAI,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC,CAAC,CAAC,OAAO,GAAG,MAAM,GAAG;CAE3E,MAAM,cAAc,MAAM,YAAY,GAAG,KAAK,SAAS,IAAI,EAAE,OAAO;CAEpE,MAAM,EAAE,WAAW,MAAM,GAAG,sDAAsD;CAClF,OAAO,KAAK,QAAQ,aAAa,MAAM;AACzC"}
1
+ {"version":3,"file":"pack.js","names":[],"sources":["../../src/test-utils/pack.ts"],"sourcesContent":["import path from \"node:path\"\n\nimport bun from \"bun\"\n\nimport { createShell } from \"#test-utils/shell/shell.ts\"\nimport { makeTempDir } from \"#test-utils/temp-dir.ts\"\n\nconst packs = new Map<string, Promise<string>>()\n\nconst buildAndPack = async (root: string) => {\n const run = createShell({ cwd: root })\n if (await bun.file(path.join(root, \"tsdown.config.ts\")).exists()) await run`bun tsdown`\n\n const destination = await makeTempDir()\n // Skip lifecycle scripts because a `prepare` script would rebuild and run the package's own tasks.\n const { stdout } = await run`bun pm pack --ignore-scripts --quiet --destination ${destination}`\n return path.resolve(destination, stdout)\n}\n\n/**\n * Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path.\n * Runs once per resolved root for the life of the test process.\n */\nexport const packPackage = async (root: string) => {\n const resolvedRoot = path.resolve(root)\n const existingPack = packs.get(resolvedRoot)\n if (existingPack) return existingPack\n\n // Cache the promise so concurrent callers share one build.\n const pack = buildAndPack(resolvedRoot)\n packs.set(resolvedRoot, pack)\n return pack\n}\n"],"mappings":";;;;;AAOA,MAAM,wBAAQ,IAAI,IAA6B;AAE/C,MAAM,eAAe,OAAO,SAAiB;CAC3C,MAAM,MAAM,YAAY,EAAE,KAAK,KAAK,CAAC;CACrC,IAAI,MAAM,IAAI,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC,CAAC,CAAC,OAAO,GAAG,MAAM,GAAG;CAE3E,MAAM,cAAc,MAAM,YAAY;CAEtC,MAAM,EAAE,WAAW,MAAM,GAAG,sDAAsD;CAClF,OAAO,KAAK,QAAQ,aAAa,MAAM;AACzC;;;;;AAMA,MAAa,cAAc,OAAO,SAAiB;CACjD,MAAM,eAAe,KAAK,QAAQ,IAAI;CACtC,MAAM,eAAe,MAAM,IAAI,YAAY;CAC3C,IAAI,cAAc,OAAO;CAGzB,MAAM,OAAO,aAAa,YAAY;CACtC,MAAM,IAAI,cAAc,IAAI;CAC5B,OAAO;AACT"}