@adamhl8/configs 4.0.0 → 4.1.1
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/README.md +30 -13
- package/dist/configs/bask.base.d.ts +1 -2
- package/dist/configs/bask.base.js +7 -0
- package/dist/configs/bask.base.js.map +1 -1
- package/dist/configs/commitlint.base.d.ts +1 -2
- package/dist/configs/configs.d.ts +7 -0
- package/dist/configs/configs.js +7 -0
- package/dist/configs/knip.base.d.ts +17 -6
- package/dist/configs/knip.base.js +18 -9
- package/dist/configs/knip.base.js.map +1 -1
- package/dist/configs/oxfmt.base.d.ts +1 -2
- package/dist/configs/oxlint.base.d.ts +1 -2
- package/dist/configs/oxlint.base.js +11 -2
- package/dist/configs/oxlint.base.js.map +1 -1
- package/dist/configs/release-it.base.d.ts +1 -2
- package/dist/configs/tsconfig.base.json +1 -0
- package/dist/configs/tsdown.base.d.ts +1 -2
- package/dist/dep-report/dep-report.js +71 -0
- package/dist/dep-report/dep-report.js.map +1 -0
- package/dist/dep-report/prompt.md +28 -0
- package/dist/env/index.d.ts +1 -2
- package/dist/env/utils.d.ts +1 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/merge-config/merge-config.d.ts +5 -1
- package/dist/merge-config/merge-config.js +17 -7
- package/dist/merge-config/merge-config.js.map +1 -1
- package/dist/merge-config/merge.types.d.ts +1 -2
- package/dist/test-utils/fixture.d.ts +1 -2
- package/dist/test-utils/index.d.ts +1 -1
- package/dist/test-utils/pack.d.ts +1 -2
- package/dist/test-utils/shell/command.d.ts +1 -2
- package/dist/test-utils/shell/command.js.map +1 -1
- package/dist/test-utils/shell/env.d.ts +1 -2
- package/dist/test-utils/shell/shell.d.ts +2 -1
- package/dist/test-utils/shell/shell.js +2 -1
- package/dist/test-utils/shell/shell.js.map +1 -1
- package/dist/test-utils/temp-dir.d.ts +1 -2
- package/dist/test-utils/temp-dir.js +1 -1
- package/package.json +20 -18
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Configs, tasks, and workflows I use across my TS projects.
|
|
|
26
26
|
- [release-it](#release-it)
|
|
27
27
|
- [lefthook](#lefthook)
|
|
28
28
|
- [bask tasks](#bask-tasks)
|
|
29
|
+
- [Dependency report](#dependency-report)
|
|
29
30
|
- [Synced files](#synced-files)
|
|
30
31
|
- [bunfig](#bunfig)
|
|
31
32
|
- [gitignore](#gitignore)
|
|
@@ -152,11 +153,13 @@ export default defineConfig(config)
|
|
|
152
153
|
|
|
153
154
|
The base turns on every rule category as an error, with type-aware linting and type checking, then turns off the rules that don't fit. It also loads these JS plugins with every rule on, except the rules a native rule already covers:
|
|
154
155
|
|
|
155
|
-
- Always: [bunisms](https://github.com/himynameisdave/eslint-plugin-bunisms), [clean-modules](https://github.com/adamhl8/
|
|
156
|
+
- Always: [bunisms](https://github.com/himynameisdave/eslint-plugin-bunisms), [clean-modules](https://github.com/adamhl8/oxlint-plugin-clean-modules), [directive-comments](https://github.com/tunderadev/oxlint-plugin-directive-comments), [e18e](https://github.com/e18e/eslint-plugin), [package-boundaries](https://github.com/adamhl8/oxlint-plugin-package-boundaries), and [regexp](https://github.com/ota-meshi/eslint-plugin-regexp)
|
|
156
157
|
- When the project depends on `hono`: [hono](https://github.com/ouka-lab/eslint-plugin-hono)
|
|
157
158
|
- When the project depends on `react`: [react-web-api](https://github.com/Rel1cx/eslint-react) and [react-you-might-not-need-an-effect](https://github.com/nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect)
|
|
158
159
|
- When the project has a Tailwind stylesheet: [oxlint-tailwindcss](https://github.com/sergioazoc/oxlint-tailwindcss)
|
|
159
160
|
|
|
161
|
+
package-boundaries is off for tests, in `__tests__` dirs and `*.test.ts` files, because a test may import any module.
|
|
162
|
+
|
|
160
163
|
The plugins are loaded from `@adamhl8/configs`'s own dependencies, so the project doesn't install them. In a project whose `package.json` has `engines.node`, the bunisms rules are off in `src/` (except in tests), because that code runs on Node.
|
|
161
164
|
|
|
162
165
|
oxlint-tailwindcss runs every rule except `enforce-sort-order` and `enforce-consistent-line-wrapping` (oxfmt handles these), `enforce-logical` (it conflicts with `enforce-physical`), and `max-class-count`. It reads the design system from the same stylesheet oxfmt sorts against. If that's the wrong file, set `settings: { tailwindcss: { entryPoint: "path/to/global.css" } }`, alongside the oxfmt `sortTailwindcss` override.
|
|
@@ -172,7 +175,14 @@ const config = knipConfig({ ... })
|
|
|
172
175
|
export default config
|
|
173
176
|
```
|
|
174
177
|
|
|
175
|
-
The base leaves `fixtures` and `fixture` dirs out of the analysis, at any depth. It adds `**/*.test.ts` and `bask.ts` to the bun plugin's entries rather than the top-level `entry
|
|
178
|
+
The base leaves `fixtures` and `fixture` dirs out of the analysis, at any depth. It adds `**/*.test.ts` and `bask.ts` to the bun plugin's entries rather than the top-level `entry`. knip doesn't see commands run through bask's `sh`, so a dependency that's only run there goes in `ignoreDependencies`.
|
|
179
|
+
|
|
180
|
+
`knipConfig` returns a function, because knip passes it the CLI arguments. The `lint` task runs knip twice:
|
|
181
|
+
|
|
182
|
+
- `knip` checks everything, tests included.
|
|
183
|
+
- `knip --production` leaves out tests and devDependencies. It reports an export that only tests use, so a package's main module exports only what runtime code uses. It keeps an export that its own module uses, so a test can import it from that module. It also leaves `__tests__` dirs out, and skips binaries, because dev tools come from devDependencies.
|
|
184
|
+
|
|
185
|
+
The production run starts from the entries marked with a trailing `!`. The base tsconfig's `outDir` lets knip map the `dist/` files in `package.json`'s `main`, `bin`, and `exports` back to `src/`, so those count without any marking. knip's default entries (`index`, `cli`, and `main`, at the root or in `src/`) are marked too. A project's own top-level `entry` replaces knip's default entries. So mark each runtime entry the project lists, like `entry: ["src/server.ts!"]`. An entry without the `!`, like a script or a test that runs by path, counts only in the plain run.
|
|
176
186
|
|
|
177
187
|
### tsdown
|
|
178
188
|
|
|
@@ -264,17 +274,17 @@ export * from "@adamhl8/configs/bask"
|
|
|
264
274
|
|
|
265
275
|
Run `bunx bask` to list them along with the allowed commit types.
|
|
266
276
|
|
|
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`
|
|
277
|
+
| Task | What it does |
|
|
278
|
+
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
279
|
+
| `lint` | Updates the README's table of contents, runs oxlint (with fixes), oxfmt, tailwint, `tofu fmt`, `tsc`, knip, and actionlint, then `test` |
|
|
280
|
+
| `build` | Runs `lint`, `tsdown`, and `tofu-check`. In CI, it fails when lint fixes or formatting changed any files |
|
|
281
|
+
| `test` | Runs `bun test`, which passes when there are no tests |
|
|
282
|
+
| `bump-deps` | Updates every dependency to its latest version, then reinstalls without the lockfile, `node_modules`, or bun's cache. Then [reports](#dependency-report) what the changes mean for the project |
|
|
283
|
+
| `release` | Starts the [release workflow](#release) (`gh workflow run release.yml`) |
|
|
284
|
+
| `release-run` | Runs `release-it --ci`. It's hidden because only the release workflow runs it |
|
|
285
|
+
| `tofu-check` | Runs `tofu plan` to check the [GitHub repo settings](#github-repo-settings) for drift |
|
|
286
|
+
| `commit-types` | Prints the allowed commit types |
|
|
287
|
+
| `prepare` | Runs `lefthook install`, the [synced files](#synced-files), and `tofu init -upgrade` |
|
|
278
288
|
|
|
279
289
|
The tasks skip the steps a project doesn't need, so projects can use them as-is:
|
|
280
290
|
|
|
@@ -282,6 +292,7 @@ The tasks skip the steps a project doesn't need, so projects can use them as-is:
|
|
|
282
292
|
- `build` runs `tsdown` only when the project has a `tsdown.config.ts`.
|
|
283
293
|
- `tofu-check` and `tofu init` run only outside CI, in a project with a root `.tofu` file, on a machine with the `adamhl8` AWS profile.
|
|
284
294
|
- `prepare` skips `lefthook install` in CI, so commits made by the workflows don't run the hooks.
|
|
295
|
+
- `bump-deps` runs the [dependency report](#dependency-report) only outside CI, when a range changed by more than a patch, on a machine with `claude` installed.
|
|
285
296
|
|
|
286
297
|
tailwint runs on `.astro` files because oxlint can't see Astro markup. It only checks and never fixes, because tailwint resolves a class conflict by deleting a class by position, not by which one wins. Projects with `.astro` files install it:
|
|
287
298
|
|
|
@@ -320,6 +331,12 @@ The only script left in `package.json` is `prepare`, which hands off to bask:
|
|
|
320
331
|
|
|
321
332
|
The `prepare` script and task `sh` calls run local bins by their bare name, because `bun run` and bask both put `node_modules/.bin` on `PATH`. Git hooks and the workflows run `bunx bask` rather than `bun bask`, because `bun bask` runs `bask.ts` instead of the bask bin.
|
|
322
333
|
|
|
334
|
+
### Dependency report
|
|
335
|
+
|
|
336
|
+
After `bump-deps` reinstalls, it runs Claude Code headless (`claude -p`) on the ranges that changed. It skips patch-only bumps of 1.0+ packages, but keeps 0.x patch bumps, because those can add features or break things. Claude reads the release notes, compares rule lists and config schemas between versions, and runs the project's checks. It prints a report of what needs action, what's worth knowing, and what needs nothing. The last line is a `claude --resume` command to pick up that session and act on the report, along with what the run cost.
|
|
337
|
+
|
|
338
|
+
The run uses `auto` permission mode with the file-editing tools denied, and the prompt tells Claude not to change the project. The report runs before a project's own `bumpDeps.after` hooks. The prompt lives in `src/dep-report/prompt.md`.
|
|
339
|
+
|
|
323
340
|
## Synced files
|
|
324
341
|
|
|
325
342
|
### bunfig
|
|
@@ -6,5 +6,4 @@ export declare const lint: import("@adamhl8/bask").Task;
|
|
|
6
6
|
export declare const build: import("@adamhl8/bask").Task;
|
|
7
7
|
export declare const release: import("@adamhl8/bask").Task;
|
|
8
8
|
export declare const releaseRun: import("@adamhl8/bask").Task;
|
|
9
|
-
export declare const commitTypes: import("@adamhl8/bask").Task;
|
|
10
|
-
//# sourceMappingURL=bask.base.d.ts.map
|
|
9
|
+
export declare const commitTypes: import("@adamhl8/bask").Task;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { prepareDependencyReport } from "../dep-report/dep-report.js";
|
|
1
2
|
import { resolveProjectTailwind } from "../utils.js";
|
|
2
3
|
import { existsSync } from "node:fs";
|
|
3
4
|
import { list, task } from "@adamhl8/bask";
|
|
@@ -25,11 +26,16 @@ const prepare = task(async ({ sh }) => {
|
|
|
25
26
|
await sh`oxfmt bunfig.toml`;
|
|
26
27
|
if (await canRunTofu()) await sh`tofu init -upgrade`;
|
|
27
28
|
});
|
|
29
|
+
let reportDependencyChanges;
|
|
28
30
|
const bumpDeps = task(async ({ sh }) => {
|
|
29
31
|
await sh`bunx npm-check-updates --upgrade --format group`;
|
|
30
32
|
await sh`rm -f bun.lock`;
|
|
31
33
|
await sh`rm -rf node_modules/`;
|
|
32
34
|
await sh`bun install --no-summary --no-cache`;
|
|
35
|
+
await reportDependencyChanges?.();
|
|
36
|
+
});
|
|
37
|
+
bumpDeps.before(async () => {
|
|
38
|
+
if (!inCi) reportDependencyChanges = await prepareDependencyReport();
|
|
33
39
|
});
|
|
34
40
|
const test = task(async ({ sh }) => {
|
|
35
41
|
await sh`bun test --pass-with-no-tests`.echo(false);
|
|
@@ -51,6 +57,7 @@ const lint = task(async ({ sh }) => {
|
|
|
51
57
|
if (tofuFiles.length > 0) await sh`tofu fmt ${tofuFiles}`;
|
|
52
58
|
await sh`tsc`;
|
|
53
59
|
await sh`knip-bun`;
|
|
60
|
+
await sh`knip-bun --production`;
|
|
54
61
|
if (existsSync(".github/workflows")) await sh`actionlint`;
|
|
55
62
|
await test();
|
|
56
63
|
});
|
|
@@ -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`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":"
|
|
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 { prepareDependencyReport } from \"#dep-report/dep-report.ts\"\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\nlet reportDependencyChanges: (() => Promise<void>) | undefined\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 await reportDependencyChanges?.()\n})\n\n// Register the snapshot here so it runs before a project's own `before` hooks, which can bump ranges too.\nbumpDeps.before(async () => {\n if (!inCi) reportDependencyChanges = await prepareDependencyReport()\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 await sh`knip-bun --production`\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":";;;;;;AAQA,MAAM,OAAO,QAAQ,QAAQ,IAAI,KAAK;;AAGtC,MAAM,UAAU,OAAO,cAAwB;CAE7C,QAAO,MADc,CAAC,2DAA2D,YAAY,MAAM,CAA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A;EACA;EACA;EACA;CACF,CAAC;CACD,IAAI,UAAU,SAAS,GAAG,MAAM,EAAE,YAAY;CAE9C,MAAM,EAAE;CACR,MAAM,EAAE;CACR,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,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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { commitlintConfig } from "./commitlint.base.js";
|
|
2
|
+
import { KnipArgs, knipConfig } from "./knip.base.js";
|
|
3
|
+
import { oxfmtConfig } from "./oxfmt.base.js";
|
|
4
|
+
import { oxlintConfig } from "./oxlint.base.js";
|
|
5
|
+
import { releaseItConfig } from "./release-it.base.js";
|
|
6
|
+
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./tsdown.base.js";
|
|
7
|
+
export { type KnipArgs, commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { commitlintConfig } from "./commitlint.base.js";
|
|
2
|
+
import { knipConfig } from "./knip.base.js";
|
|
3
|
+
import { oxfmtConfig } from "./oxfmt.base.js";
|
|
4
|
+
import { oxlintConfig } from "./oxlint.base.js";
|
|
5
|
+
import { releaseItConfig } from "./release-it.base.js";
|
|
6
|
+
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./tsdown.base.js";
|
|
7
|
+
export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KnipConfig } from "knip";
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ArgsMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
|
+
import { KnipConfig, KnipConfiguration } from "knip";
|
|
3
|
+
type KnipCliArgs = Parameters<Extract<KnipConfig, (...args: never[]) => unknown>>[0];
|
|
4
|
+
/**
|
|
5
|
+
* The CLI arguments knip passes to its config. Wrap them in an interface so a hover shows `KnipArgs` instead of every
|
|
6
|
+
* option. Export it so a project's `knip.ts` can name it in its declarations.
|
|
7
|
+
*/
|
|
8
|
+
export interface KnipArgs extends KnipCliArgs {}
|
|
9
|
+
/** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */
|
|
10
|
+
declare const createBaseConfig: ({ production }: KnipArgs) => {
|
|
11
|
+
readonly project: ["**/*!", "!**/__tests__/**!", "!**/fixtures/**", "!**/fixture/**"];
|
|
5
12
|
readonly bun: {
|
|
6
13
|
readonly entry: ["**/*.test.ts", "bask.ts"];
|
|
7
14
|
};
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
readonly ignoreExportsUsedInFile: boolean;
|
|
16
|
+
readonly exclude: [] | ["binaries"];
|
|
17
|
+
};
|
|
18
|
+
type BaseConfig = ReturnType<typeof createBaseConfig>;
|
|
19
|
+
export declare const knipConfig: ArgsMergeConfigFn<KnipConfiguration, BaseConfig, KnipArgs>;
|
|
20
|
+
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createArgsMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
|
+
// src/configs/knip.base.ts
|
|
3
|
+
/** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */
|
|
4
|
+
const createBaseConfig = ({ production }) => {
|
|
5
|
+
const isProduction = production === true;
|
|
6
|
+
return {
|
|
7
|
+
project: [
|
|
8
|
+
"**/*!",
|
|
9
|
+
"!**/__tests__/**!",
|
|
10
|
+
"!**/fixtures/**",
|
|
11
|
+
"!**/fixture/**"
|
|
12
|
+
],
|
|
13
|
+
bun: { entry: ["**/*.test.ts", "bask.ts"] },
|
|
14
|
+
ignoreExportsUsedInFile: isProduction,
|
|
15
|
+
exclude: isProduction ? ["binaries"] : []
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const knipConfig = createArgsMergeConfigFn(createBaseConfig);
|
|
10
19
|
export { knipConfig };
|
|
11
20
|
|
|
12
21
|
//# sourceMappingURL=knip.base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig } from \"knip\"\n\nimport {
|
|
1
|
+
{"version":3,"file":"knip.base.js","names":[],"sources":["../../src/configs/knip.base.ts"],"sourcesContent":["import type { KnipConfig, KnipConfiguration } from \"knip\"\n\nimport type { ArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createArgsMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\ntype KnipCliArgs = Parameters<Extract<KnipConfig, (...args: never[]) => unknown>>[0]\n\n/**\n * The CLI arguments knip passes to its config. Wrap them in an interface so a hover shows `KnipArgs` instead of every\n * option. Export it so a project's `knip.ts` can name it in its declarations.\n */\n// oxlint-disable-next-line typescript/no-empty-interface, typescript/no-empty-object-type - name knip's CLI args so a hover shows the name, not every option\nexport interface KnipArgs extends KnipCliArgs {}\n\n/** Builds the base config for one knip run. `knip --production` leaves out tests and devDependencies. */\nconst createBaseConfig = ({ production }: KnipArgs) => {\n const isProduction = production === true\n return {\n // Mark `**/*` with `!`, because `knip --production` only reads marked patterns.\n // Mark the `__tests__` exclusion too, so it applies only to the production run.\n // Exclude fixtures with negated `project` globs because knip hints to remove an `ignore` glob that hides nothing.\n project: [\"**/*!\", \"!**/__tests__/**!\", \"!**/fixtures/**\", \"!**/fixture/**\"],\n bun: {\n // List `bask.ts` because bask loads it by path and nothing imports it.\n // Add it here because a top-level `entry` replaces knip's default entries.\n entry: [\"**/*.test.ts\", \"bask.ts\"],\n },\n // Keep an export that its own module uses, so a test can import it from that module.\n // A re-export that only tests use still shows up, so a package's main module exports only what runtime code uses.\n ignoreExportsUsedInFile: isProduction,\n // Skip binaries in the production run, because it ignores devDependencies and reports the dev tools that configs run.\n // Mark each branch `as const`, because the outer `as const` doesn't reach into a conditional.\n exclude: isProduction ? ([\"binaries\"] as const) : ([] as const),\n } as const satisfies KnipConfiguration\n}\n\ntype BaseConfig = ReturnType<typeof createBaseConfig>\n\n// Return the config as a function, because knip calls it with its CLI arguments and the production run needs its own settings.\n// Annotate the export so the published types name knip's types instead of spelling them out.\nexport const knipConfig: ArgsMergeConfigFn<KnipConfiguration, BaseConfig, KnipArgs> = createArgsMergeConfigFn<\n KnipConfiguration,\n BaseConfig,\n KnipArgs\n>(createBaseConfig)\n"],"mappings":";;;AAeA,MAAM,oBAAoB,EAAE,iBAA2B;CACrD,MAAM,eAAe,eAAe;CACpC,OAAO;EAIL,SAAS;GAAC;GAAS;GAAqB;GAAmB;EAAgB;EAC3E,KAAK,EAGH,OAAO,CAAC,gBAAgB,SAAS,EACnC;EAGA,yBAAyB;EAGzB,SAAS,eAAgB,CAAC,UAAU,IAAe,CAAC;CACtD;AACF;AAMA,MAAa,aAAyE,wBAIpF,gBAAgB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
2
|
import { readProjectPackageJson, resolvePackagePath, resolveProjectTailwind } from "../utils.js";
|
|
3
|
-
import cleanModulesPlugin from "@adamhl8/
|
|
3
|
+
import cleanModulesPlugin from "@adamhl8/oxlint-plugin-clean-modules";
|
|
4
|
+
import packageBoundariesPlugin from "@adamhl8/oxlint-plugin-package-boundaries";
|
|
4
5
|
import e18ePlugin from "@e18e/eslint-plugin";
|
|
5
6
|
import bunismsPlugin from "eslint-plugin-bunisms";
|
|
6
7
|
import honoPlugin from "eslint-plugin-hono";
|
|
@@ -31,7 +32,7 @@ const plugins = {
|
|
|
31
32
|
rules: { "bunisms/prefer-mock-restore-in-after-each": "off" }
|
|
32
33
|
},
|
|
33
34
|
"clean-modules": {
|
|
34
|
-
package: "@adamhl8/
|
|
35
|
+
package: "@adamhl8/oxlint-plugin-clean-modules",
|
|
35
36
|
pluginRules: cleanModulesPlugin.rules
|
|
36
37
|
},
|
|
37
38
|
"directive-comments": {
|
|
@@ -68,6 +69,14 @@ const plugins = {
|
|
|
68
69
|
pluginRules: honoPlugin.rules,
|
|
69
70
|
rules: { "hono/no-process-env": "off" }
|
|
70
71
|
},
|
|
72
|
+
"package-boundaries": {
|
|
73
|
+
overrides: [{
|
|
74
|
+
files: ["**/__tests__/**", "**/*.test.{ts,tsx}"],
|
|
75
|
+
rules: setAllPluginRules("package-boundaries", packageBoundariesPlugin.rules, "off")
|
|
76
|
+
}],
|
|
77
|
+
package: "@adamhl8/oxlint-plugin-package-boundaries",
|
|
78
|
+
pluginRules: packageBoundariesPlugin.rules
|
|
79
|
+
},
|
|
71
80
|
"react-web-api": {
|
|
72
81
|
enabled: dependencies.has("react"),
|
|
73
82
|
package: "eslint-plugin-react-web-api",
|
|
@@ -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 // 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;GAA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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/oxlint-plugin-clean-modules\"\nimport packageBoundariesPlugin from \"@adamhl8/oxlint-plugin-package-boundaries\"\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/oxlint-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 \"package-boundaries\": {\n overrides: [\n {\n files: [\"**/__tests__/**\", \"**/*.test.{ts,tsx}\"],\n // Let a test import any module, because it checks a package's internals, not only its public surface.\n rules: setAllPluginRules(\"package-boundaries\", packageBoundariesPlugin.rules, \"off\"),\n },\n ],\n package: \"@adamhl8/oxlint-plugin-package-boundaries\",\n pluginRules: packageBoundariesPlugin.rules,\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":";;;;;;;;;;;;;;AAgBA,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,O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ChG,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"}
|
|
@@ -79,5 +79,4 @@ declare const binConfig: {
|
|
|
79
79
|
export declare const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig>;
|
|
80
80
|
export declare const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig>;
|
|
81
81
|
export declare const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig>;
|
|
82
|
-
export {};
|
|
83
|
-
//# sourceMappingURL=tsdown.base.d.ts.map
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { isPlainObject } from "es-toolkit/predicate";
|
|
4
|
+
import { $ } from "bun";
|
|
5
|
+
import { difference, findMinimumForRange, tryParseRange } from "verkit";
|
|
6
|
+
// src/dep-report/dep-report.ts
|
|
7
|
+
const DEPENDENCY_FIELDS = [
|
|
8
|
+
"dependencies",
|
|
9
|
+
"devDependencies",
|
|
10
|
+
"peerDependencies",
|
|
11
|
+
"optionalDependencies"
|
|
12
|
+
];
|
|
13
|
+
/** Reads every dependency range in the project's `package.json`, keyed by `<field> <name>`. */
|
|
14
|
+
const readDependencyRanges = () => {
|
|
15
|
+
const packageJson = JSON.parse(readFileSync("package.json", "utf8"));
|
|
16
|
+
const fields = isPlainObject(packageJson) ? packageJson : {};
|
|
17
|
+
const ranges = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const field of DEPENDENCY_FIELDS) {
|
|
19
|
+
const dependencies = fields[field];
|
|
20
|
+
if (!isPlainObject(dependencies)) continue;
|
|
21
|
+
for (const [name, range] of Object.entries(dependencies)) if (typeof range === "string") ranges.set(`${field} ${name}`, range);
|
|
22
|
+
}
|
|
23
|
+
return ranges;
|
|
24
|
+
};
|
|
25
|
+
/** Returns the lowest version a range allows, or nothing for a missing or non-semver range like `workspace:*`. */
|
|
26
|
+
const lowestVersion = (range) => {
|
|
27
|
+
const parsedRange = range === void 0 ? void 0 : tryParseRange(range);
|
|
28
|
+
return parsedRange ? findMinimumForRange(parsedRange) : void 0;
|
|
29
|
+
};
|
|
30
|
+
/** Checks whether a range change only bumps the patch version of a 1.0+ package. */
|
|
31
|
+
const isPatchOnlyChange = (oldRange, newRange) => {
|
|
32
|
+
const oldVersion = lowestVersion(oldRange);
|
|
33
|
+
const newVersion = lowestVersion(newRange);
|
|
34
|
+
if (!oldVersion || !newVersion) return false;
|
|
35
|
+
return oldVersion.major > 0 && difference(oldVersion, newVersion) === "patch";
|
|
36
|
+
};
|
|
37
|
+
/** Lists each range that changed by more than a patch as `<field> <name>: <old> -> <new>`. */
|
|
38
|
+
const listRangeChanges = (before, after) => {
|
|
39
|
+
return [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].filter((key) => before.get(key) !== after.get(key) && !isPatchOnlyChange(before.get(key), after.get(key))).map((key) => `${key}: ${before.get(key) ?? "(none)"} -> ${after.get(key) ?? "(none)"}`);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Snapshots the project's dependency ranges and loads the prompt. Returns a function that asks Claude Code to research
|
|
43
|
+
* the ranges that changed since the snapshot and prints its report. That function skips the report when nothing changed
|
|
44
|
+
* or `claude` isn't installed.
|
|
45
|
+
*/
|
|
46
|
+
const prepareDependencyReport = async () => {
|
|
47
|
+
const rangesBefore = readDependencyRanges();
|
|
48
|
+
const instructions = await Bun.file(fileURLToPath(new URL("prompt.md", import.meta.url))).text();
|
|
49
|
+
return async () => {
|
|
50
|
+
const changes = listRangeChanges(rangesBefore, readDependencyRanges());
|
|
51
|
+
if (changes.length === 0) return;
|
|
52
|
+
if (!Bun.which("claude")) {
|
|
53
|
+
console.log("\nSkipping the dependency report because `claude` isn't installed.");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
console.log("\nAsking Claude to review the dependency changes. This takes a few minutes.");
|
|
57
|
+
const prompt = `${instructions}\n${changes.join("\n")}\n`;
|
|
58
|
+
const output = await $`claude -p ${prompt} --output-format json --permission-mode auto --disallowedTools Edit,Write,NotebookEdit --name ${"bump-deps report"}`.nothrow().quiet();
|
|
59
|
+
const parsed = output.exitCode === 0 ? output.json() : void 0;
|
|
60
|
+
if (!parsed || parsed.is_error) {
|
|
61
|
+
console.log(`\nThe dependency report failed:\n${output.stderr.toString() || output.stdout.toString()}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
console.log(`\n${parsed.result}`);
|
|
65
|
+
const cost = parsed.total_cost_usd === void 0 ? "" : ` (cost: $${parsed.total_cost_usd.toFixed(2)})`;
|
|
66
|
+
console.log(`\nFollow up with: claude --resume ${parsed.session_id}${cost}`);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export { prepareDependencyReport };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=dep-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dep-report.js","names":[],"sources":["../../src/dep-report/dep-report.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\"\nimport { fileURLToPath } from \"node:url\"\n\nimport { $ } from \"bun\"\nimport { isPlainObject } from \"es-toolkit/predicate\"\nimport { difference, findMinimumForRange, tryParseRange } from \"verkit\"\n\nconst DEPENDENCY_FIELDS = [\"dependencies\", \"devDependencies\", \"peerDependencies\", \"optionalDependencies\"] as const\n\n/** Reads every dependency range in the project's `package.json`, keyed by `<field> <name>`. */\nconst readDependencyRanges = () => {\n const packageJson: unknown = JSON.parse(readFileSync(\"package.json\", \"utf8\"))\n const fields = isPlainObject(packageJson) ? packageJson : {}\n\n const ranges = new Map<string, string>()\n for (const field of DEPENDENCY_FIELDS) {\n const dependencies: unknown = fields[field]\n if (!isPlainObject(dependencies)) continue\n for (const [name, range] of Object.entries(dependencies))\n if (typeof range === \"string\") ranges.set(`${field} ${name}`, range)\n }\n return ranges\n}\n\n/** Returns the lowest version a range allows, or nothing for a missing or non-semver range like `workspace:*`. */\nconst lowestVersion = (range: string | undefined) => {\n const parsedRange = range === undefined ? undefined : tryParseRange(range)\n return parsedRange ? findMinimumForRange(parsedRange) : undefined\n}\n\n/** Checks whether a range change only bumps the patch version of a 1.0+ package. */\nconst isPatchOnlyChange = (oldRange: string | undefined, newRange: string | undefined) => {\n const oldVersion = lowestVersion(oldRange)\n const newVersion = lowestVersion(newRange)\n if (!oldVersion || !newVersion) return false\n // Keep 0.x patch bumps because a 0.x patch release can add features or break things.\n return oldVersion.major > 0 && difference(oldVersion, newVersion) === \"patch\"\n}\n\n/** Lists each range that changed by more than a patch as `<field> <name>: <old> -> <new>`. */\nconst listRangeChanges = (before: ReadonlyMap<string, string>, after: ReadonlyMap<string, string>) => {\n const keys = new Set([...before.keys(), ...after.keys()])\n return [...keys]\n .filter((key) => before.get(key) !== after.get(key) && !isPatchOnlyChange(before.get(key), after.get(key)))\n .map((key) => `${key}: ${before.get(key) ?? \"(none)\"} -> ${after.get(key) ?? \"(none)\"}`)\n}\n\ninterface ClaudeResult {\n is_error: boolean\n result: string\n session_id: string\n total_cost_usd?: number\n}\n\n/**\n * Snapshots the project's dependency ranges and loads the prompt. Returns a function that asks Claude Code to research\n * the ranges that changed since the snapshot and prints its report. That function skips the report when nothing changed\n * or `claude` isn't installed.\n */\nexport const prepareDependencyReport = async () => {\n const rangesBefore = readDependencyRanges()\n // Read the prompt now because the reinstall can move this package to a new folder and delete the old one.\n const instructions = await Bun.file(fileURLToPath(new URL(\"prompt.md\", import.meta.url))).text()\n\n return async () => {\n const changes = listRangeChanges(rangesBefore, readDependencyRanges())\n if (changes.length === 0) return\n if (!Bun.which(\"claude\")) {\n console.log(\"\\nSkipping the dependency report because `claude` isn't installed.\")\n return\n }\n\n console.log(\"\\nAsking Claude to review the dependency changes. This takes a few minutes.\")\n const prompt = `${instructions}\\n${changes.join(\"\\n\")}\\n`\n\n // Use `auto` because the research runs commands that an allowlist can't predict.\n // Deny the file tools because the report must not change the project.\n const output =\n await $`claude -p ${prompt} --output-format json --permission-mode auto --disallowedTools Edit,Write,NotebookEdit --name ${\"bump-deps report\"}`\n .nothrow()\n .quiet()\n\n // Report a failure without throwing because the dependencies are already bumped.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - trust the shape that `claude --output-format json` prints\n const parsed = output.exitCode === 0 ? (output.json() as ClaudeResult) : undefined\n if (!parsed || parsed.is_error) {\n console.log(`\\nThe dependency report failed:\\n${output.stderr.toString() || output.stdout.toString()}`)\n return\n }\n\n console.log(`\\n${parsed.result}`)\n const cost = parsed.total_cost_usd === undefined ? \"\" : ` (cost: $${parsed.total_cost_usd.toFixed(2)})`\n console.log(`\\nFollow up with: claude --resume ${parsed.session_id}${cost}`)\n }\n}\n"],"mappings":";;;;;;AAOA,MAAM,oBAAoB;CAAC;CAAgB;CAAmB;CAAoB;AAAsB;;AAGxG,MAAM,6BAA6B;CACjC,MAAM,cAAuB,KAAK,MAAM,aAAa,gBAAgB,MAAM,CAAC;CAC5E,MAAM,SAAS,cAAc,WAAW,IAAI,cAAc,CAAC;CAE3D,MAAM,yBAAS,IAAI,IAAoB;CACvC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AAW,GAAG;EAC1B,IAAI,CAAC,IAAI,MAAM,QAAQ,GAAG;GACxB,QAAQ,IAAI,oEAAoE;GAChF;EACF;EAEA,QAAQ,IAAI,6EAA6E;EACzF,MAAM,SAAS,GAAG,aAAa,IAAI,QAAQ,KAAK,IAAI,EAAE;EAItD,MAAM,SACJ,MAAM,CAAC,aAAa,OAAO,gGAAgG,qBACxH,QAAQ,CAAC,CACT,MAAM;EAIX,MAAM,SAAS,OAAO,aAAa,IAAK,OAAO,KAAK,IAAqB,KAAA;EACzE,IAAI,CAAC,UAAU,OAAO,UAAU;GAC9B,QAAQ,IAAI,oCAAoC,OAAO,OAAO,SAAS,KAAK,OAAO,OAAO,SAAS,GAAG;GACtG;EACF;EAEA,QAAQ,IAAI,KAAK,OAAO,QAAQ;EAChC,MAAM,OAAO,OAAO,mBAAmB,KAAA,IAAY,KAAK,YAAY,OAAO,eAAe,QAAQ,CAAC,EAAE;EACrG,QAAQ,IAAI,qCAAqC,OAAO,aAAa,MAAM;CAC7E;AACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
`bask bump-deps` just bumped this project's dependencies and reinstalled them. The changed ranges are listed at the end of this prompt.
|
|
2
|
+
|
|
3
|
+
Find anything in these updates that matters for this project, and report it. Your report prints to the terminal when the task finishes. The user can resume this session to act on it.
|
|
4
|
+
|
|
5
|
+
## Research
|
|
6
|
+
|
|
7
|
+
- Read the project's configs, scripts, and source to see how it uses each package.
|
|
8
|
+
- Read the release notes for every version in each range, not just the newest. Use `gh release list` and `gh release view` on the package's repo, or the changelog in its npm package.
|
|
9
|
+
- Release notes don't always list new rules or options. For lint plugins and configurable tools, compare the two versions directly. Download the old one with `npm pack` into a temp dir, then diff its rule names, config schema, or types against the installed one.
|
|
10
|
+
- Run the project's checks without changing anything: the type checker, the linter without `--fix`, the formatter in check mode, knip, the tests, and the build if there is one.
|
|
11
|
+
- When a check fails, confirm which bump caused it. For example, run the previous version with `bunx <package>@<old version>` and compare.
|
|
12
|
+
|
|
13
|
+
## Rules
|
|
14
|
+
|
|
15
|
+
- Don't edit, create, or delete files in the project. Put downloads in a directory from `mktemp -d`.
|
|
16
|
+
- Don't commit, install, or change dependencies.
|
|
17
|
+
|
|
18
|
+
## Report
|
|
19
|
+
|
|
20
|
+
Write plain text that reads well unrendered: short headings, `-` bullets, and no tables. Group findings under these headings and skip empty ones:
|
|
21
|
+
|
|
22
|
+
- Needs action: failing checks, or config that a bump breaks. Name the file and line, and say what to change. Say whether the linter's `--fix` would rewrite it, and whether that rewrite is safe.
|
|
23
|
+
- Worth knowing: new rules, options, or behavior that changes how the project's tools run, and new features the project might want to use.
|
|
24
|
+
- Nothing to do: one line per remaining package.
|
|
25
|
+
|
|
26
|
+
End with one line that lists the checks you ran and whether they passed.
|
|
27
|
+
|
|
28
|
+
## Changed ranges
|
package/dist/env/index.d.ts
CHANGED
package/dist/env/utils.d.ts
CHANGED
|
@@ -6,5 +6,4 @@ import { type } from "arktype";
|
|
|
6
6
|
* omitted entirely if no fallback is given.
|
|
7
7
|
*/
|
|
8
8
|
export declare function requireWhen<const def>(when: boolean, type: type.validate<def>): ReturnType<type.instantiate<def>["optional"]>;
|
|
9
|
-
export declare function requireWhen<const def>(when: boolean, type: type.validate<def>, fallback: type.infer<def>): type.instantiate<def>;
|
|
10
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
9
|
+
export declare function requireWhen<const def>(when: boolean, type: type.validate<def>, fallback: type.infer<def>): type.instantiate<def>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { commitlintConfig } from "./configs/commitlint.base.js";
|
|
2
|
-
import { knipConfig } from "./configs/knip.base.js";
|
|
2
|
+
import { KnipArgs, knipConfig } from "./configs/knip.base.js";
|
|
3
3
|
import { oxfmtConfig } from "./configs/oxfmt.base.js";
|
|
4
4
|
import { oxlintConfig } from "./configs/oxlint.base.js";
|
|
5
5
|
import { releaseItConfig } from "./configs/release-it.base.js";
|
|
6
6
|
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./configs/tsdown.base.js";
|
|
7
|
-
|
|
7
|
+
import "./configs/configs.js";
|
|
8
|
+
export { type KnipArgs, commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import { oxfmtConfig } from "./configs/oxfmt.base.js";
|
|
|
4
4
|
import { oxlintConfig } from "./configs/oxlint.base.js";
|
|
5
5
|
import { releaseItConfig } from "./configs/release-it.base.js";
|
|
6
6
|
import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./configs/tsdown.base.js";
|
|
7
|
+
import "./configs/configs.js";
|
|
7
8
|
export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
|
|
@@ -13,4 +13,8 @@ import { ReadonlyDeep } from "type-fest";
|
|
|
13
13
|
export type MergeConfigFn<UserConfig, BaseConfig> = (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>>(userConfig: UserConfigToMerge) => MergedConfig<BaseConfig, UserConfigToMerge>) & (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>, const ReplaceConfigToMerge extends ReadonlyDeep<Partial<UserConfig>>>(userConfig: UserConfigToMerge, replaceConfig: ReplaceConfigToMerge) => MergedConfig<MergedConfig<BaseConfig, UserConfigToMerge>, ReplaceConfigToMerge, "replace">);
|
|
14
14
|
/** A MergeConfigFn that can also be called with no arguments, returning a writable clone of the base config. */
|
|
15
15
|
export type OptionalMergeConfigFn<UserConfig, BaseConfig> = MergeConfigFn<UserConfig, BaseConfig> & (() => Clean<BaseConfig>);
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* An OptionalMergeConfigFn whose result is a function of `Args`, for a tool that calls its config with arguments. The
|
|
18
|
+
* merge waits for that call, because `Args` picks the base config. The result type is the same for any `Args`.
|
|
19
|
+
*/
|
|
20
|
+
export type ArgsMergeConfigFn<UserConfig, BaseConfig, Args> = (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>>(userConfig: UserConfigToMerge) => (args: Args) => MergedConfig<BaseConfig, UserConfigToMerge>) & (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>, const ReplaceConfigToMerge extends ReadonlyDeep<Partial<UserConfig>>>(userConfig: UserConfigToMerge, replaceConfig: ReplaceConfigToMerge) => (args: Args) => MergedConfig<MergedConfig<BaseConfig, UserConfigToMerge>, ReplaceConfigToMerge, "replace">) & (() => (args: Args) => Clean<BaseConfig>);
|
|
@@ -11,19 +11,29 @@ const merge = (target, source, mode) => mergeWith(target, cloneDeep(source), (ob
|
|
|
11
11
|
if (mode === "spread" && Array.isArray(objValue)) return [...objValue, ...userArray];
|
|
12
12
|
return userArray;
|
|
13
13
|
});
|
|
14
|
+
/** Clones `baseConfig`, then merges `userConfig` and `replaceConfig` into the clone. */
|
|
15
|
+
const mergeConfig = (baseConfig, userConfig, replaceConfig) => {
|
|
16
|
+
const result = cloneDeep(baseConfig);
|
|
17
|
+
if (userConfig !== void 0) merge(result, userConfig, "spread");
|
|
18
|
+
if (replaceConfig !== void 0) merge(result, replaceConfig, "replace");
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
14
21
|
/**
|
|
15
22
|
* Creates a config merge function with proper types for merging with a base config. `UserConfig` is not inferrable, so
|
|
16
23
|
* both type arguments must be passed explicitly.
|
|
17
24
|
*/
|
|
18
25
|
const createMergeConfigFn = (baseConfig) => {
|
|
19
|
-
const mergeConfigFn = (userConfig, replaceConfig) =>
|
|
20
|
-
const result = cloneDeep(baseConfig);
|
|
21
|
-
if (userConfig !== void 0) merge(result, userConfig, "spread");
|
|
22
|
-
if (replaceConfig !== void 0) merge(result, replaceConfig, "replace");
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
26
|
+
const mergeConfigFn = (userConfig, replaceConfig) => mergeConfig(baseConfig, userConfig, replaceConfig);
|
|
25
27
|
return mergeConfigFn;
|
|
26
28
|
};
|
|
27
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Creates an ArgsMergeConfigFn, which builds its base config from the tool's arguments with `createBaseConfig`.
|
|
31
|
+
* `UserConfig` is not inferrable, so all three type arguments must be passed explicitly.
|
|
32
|
+
*/
|
|
33
|
+
const createArgsMergeConfigFn = (createBaseConfig) => {
|
|
34
|
+
const argsMergeConfigFn = (userConfig, replaceConfig) => (args) => mergeConfig(createBaseConfig(args), userConfig, replaceConfig);
|
|
35
|
+
return argsMergeConfigFn;
|
|
36
|
+
};
|
|
37
|
+
export { createArgsMergeConfigFn, createMergeConfigFn };
|
|
28
38
|
|
|
29
39
|
//# sourceMappingURL=merge-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-config.js","names":["baseArray"],"sources":["../../src/merge-config/merge-config.ts"],"sourcesContent":["/* oxlint-disable unicorn/prefer-structured-clone - structuredClone does not properly clone functions */\nimport { cloneDeep, mergeWith } from \"es-toolkit\"\nimport type { ReadonlyDeep } from \"type-fest\"\n\nimport type { Clean, MergedConfig, Mode } from \"#merge-config/merge.types.ts\"\n\n/**\n * The runtime counterpart of MergedConfig in merge.types.ts: a deep merge whose customizer applies the array mode. The\n * source is pre-cloned so the result never aliases the caller's objects. The merge visits string keys only, so\n * symbol-keyed properties in user configs are dropped (the types mirror this).\n */\nconst merge = (target: object, source: object, mode: Mode): object =>\n mergeWith(target, cloneDeep(source), (objValue: unknown, srcValue: unknown) => {\n if (!Array.isArray(srcValue)) return\n const userArray: unknown[] = srcValue\n if (mode === \"spread\" && Array.isArray(objValue)) {\n const baseArray: unknown[] = objValue\n return [...baseArray, ...userArray]\n }\n return userArray\n })\n\n/**\n * The merge config function. `userConfig` is deep merged into `BaseConfig` with arrays appended to the base array. The\n * optional `replaceConfig` is then deep merged into that result with arrays used as-is, so putting an array there\n * replaces just that key (sibling keys still merge normally, and a key in both configs gets the replace config's\n * value). Required keys must be provided in `userConfig`.\n *\n * The `const` type parameters keep literal types without requiring `as const` at the call site. The constraints accept\n * readonly arrays/objects (e.g. from `as const`), and the result is writable so it stays assignable to the tools' own\n * (mutable) config types.\n */\nexport type MergeConfigFn<UserConfig, BaseConfig> = (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>>(\n userConfig: UserConfigToMerge,\n) => MergedConfig<BaseConfig, UserConfigToMerge>)\n & (<\n const UserConfigToMerge extends ReadonlyDeep<UserConfig>,\n const ReplaceConfigToMerge extends ReadonlyDeep<Partial<UserConfig>>,\n >(\n userConfig: UserConfigToMerge,\n replaceConfig: ReplaceConfigToMerge,\n ) => MergedConfig<MergedConfig<BaseConfig, UserConfigToMerge>, ReplaceConfigToMerge, \"replace\">)\n\n/** A MergeConfigFn that can also be called with no arguments, returning a writable clone of the base config. */\nexport type OptionalMergeConfigFn<UserConfig, BaseConfig> = MergeConfigFn<UserConfig, BaseConfig>\n & (() => Clean<BaseConfig>)\n\n/**\n * Creates a config merge function with proper types for merging with a base config. `UserConfig` is not inferrable, so\n * both type arguments must be passed explicitly.\n */\nexport const createMergeConfigFn = <UserConfig extends object, BaseConfig extends ReadonlyDeep<UserConfig>>(\n baseConfig: BaseConfig,\n): OptionalMergeConfigFn<UserConfig, BaseConfig> => {\n // Loosely typed on purpose, the assertion below gives it the precise public signature\n const mergeConfigFn = (userConfig?: object, replaceConfig?: object)
|
|
1
|
+
{"version":3,"file":"merge-config.js","names":["baseArray"],"sources":["../../src/merge-config/merge-config.ts"],"sourcesContent":["/* oxlint-disable unicorn/prefer-structured-clone - structuredClone does not properly clone functions */\nimport { cloneDeep, mergeWith } from \"es-toolkit\"\nimport type { ReadonlyDeep } from \"type-fest\"\n\nimport type { Clean, MergedConfig, Mode } from \"#merge-config/merge.types.ts\"\n\n/**\n * The runtime counterpart of MergedConfig in merge.types.ts: a deep merge whose customizer applies the array mode. The\n * source is pre-cloned so the result never aliases the caller's objects. The merge visits string keys only, so\n * symbol-keyed properties in user configs are dropped (the types mirror this).\n */\nconst merge = (target: object, source: object, mode: Mode): object =>\n mergeWith(target, cloneDeep(source), (objValue: unknown, srcValue: unknown) => {\n if (!Array.isArray(srcValue)) return\n const userArray: unknown[] = srcValue\n if (mode === \"spread\" && Array.isArray(objValue)) {\n const baseArray: unknown[] = objValue\n return [...baseArray, ...userArray]\n }\n return userArray\n })\n\n/** Clones `baseConfig`, then merges `userConfig` and `replaceConfig` into the clone. */\nconst mergeConfig = (baseConfig: object, userConfig?: object, replaceConfig?: object) => {\n // Start from a clone so consumers can't mutate the shared base config\n const result = cloneDeep(baseConfig)\n if (userConfig !== undefined) merge(result, userConfig, \"spread\")\n if (replaceConfig !== undefined) merge(result, replaceConfig, \"replace\")\n return result\n}\n\n/**\n * The merge config function. `userConfig` is deep merged into `BaseConfig` with arrays appended to the base array. The\n * optional `replaceConfig` is then deep merged into that result with arrays used as-is, so putting an array there\n * replaces just that key (sibling keys still merge normally, and a key in both configs gets the replace config's\n * value). Required keys must be provided in `userConfig`.\n *\n * The `const` type parameters keep literal types without requiring `as const` at the call site. The constraints accept\n * readonly arrays/objects (e.g. from `as const`), and the result is writable so it stays assignable to the tools' own\n * (mutable) config types.\n */\nexport type MergeConfigFn<UserConfig, BaseConfig> = (<const UserConfigToMerge extends ReadonlyDeep<UserConfig>>(\n userConfig: UserConfigToMerge,\n) => MergedConfig<BaseConfig, UserConfigToMerge>)\n & (<\n const UserConfigToMerge extends ReadonlyDeep<UserConfig>,\n const ReplaceConfigToMerge extends ReadonlyDeep<Partial<UserConfig>>,\n >(\n userConfig: UserConfigToMerge,\n replaceConfig: ReplaceConfigToMerge,\n ) => MergedConfig<MergedConfig<BaseConfig, UserConfigToMerge>, ReplaceConfigToMerge, \"replace\">)\n\n/** A MergeConfigFn that can also be called with no arguments, returning a writable clone of the base config. */\nexport type OptionalMergeConfigFn<UserConfig, BaseConfig> = MergeConfigFn<UserConfig, BaseConfig>\n & (() => Clean<BaseConfig>)\n\n/**\n * Creates a config merge function with proper types for merging with a base config. `UserConfig` is not inferrable, so\n * both type arguments must be passed explicitly.\n */\nexport const createMergeConfigFn = <UserConfig extends object, BaseConfig extends ReadonlyDeep<UserConfig>>(\n baseConfig: BaseConfig,\n): OptionalMergeConfigFn<UserConfig, BaseConfig> => {\n // Loosely typed on purpose, the assertion below gives it the precise public signature\n const mergeConfigFn = (userConfig?: object, replaceConfig?: object) =>\n mergeConfig(baseConfig, userConfig, replaceConfig)\n\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - give the loosely typed implementation its precise public signature\n return mergeConfigFn as OptionalMergeConfigFn<UserConfig, BaseConfig>\n}\n\n/**\n * An OptionalMergeConfigFn whose result is a function of `Args`, for a tool that calls its config with arguments. The\n * merge waits for that call, because `Args` picks the base config. The result type is the same for any `Args`.\n */\nexport type ArgsMergeConfigFn<UserConfig, BaseConfig, Args> = (<\n const UserConfigToMerge extends ReadonlyDeep<UserConfig>,\n>(\n userConfig: UserConfigToMerge,\n) => (args: Args) => MergedConfig<BaseConfig, UserConfigToMerge>)\n & (<\n const UserConfigToMerge extends ReadonlyDeep<UserConfig>,\n const ReplaceConfigToMerge extends ReadonlyDeep<Partial<UserConfig>>,\n >(\n userConfig: UserConfigToMerge,\n replaceConfig: ReplaceConfigToMerge,\n ) => (args: Args) => MergedConfig<MergedConfig<BaseConfig, UserConfigToMerge>, ReplaceConfigToMerge, \"replace\">)\n & (() => (args: Args) => Clean<BaseConfig>)\n\n/**\n * Creates an ArgsMergeConfigFn, which builds its base config from the tool's arguments with `createBaseConfig`.\n * `UserConfig` is not inferrable, so all three type arguments must be passed explicitly.\n */\nexport const createArgsMergeConfigFn = <UserConfig extends object, BaseConfig extends ReadonlyDeep<UserConfig>, Args>(\n createBaseConfig: (args: Args) => BaseConfig,\n): ArgsMergeConfigFn<UserConfig, BaseConfig, Args> => {\n // Loosely typed on purpose, the assertion below gives it the precise public signature\n const argsMergeConfigFn = (userConfig?: object, replaceConfig?: object) => (args: Args) =>\n mergeConfig(createBaseConfig(args), userConfig, replaceConfig)\n\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion - give the loosely typed implementation its precise public signature\n return argsMergeConfigFn as ArgsMergeConfigFn<UserConfig, BaseConfig, Args>\n}\n"],"mappings":";;;;;;;AAWA,MAAM,SAAS,QAAgB,QAAgB,SAC7C,UAAU,QAAQ,UAAU,MAAM,IAAI,UAAmB,aAAsB;CAC7E,IAAI,CAAC,MAAM,QAAQ,QAAQ,GAAG;CAC9B,MAAM,YAAuB;CAC7B,IAAI,SAAS,YAAY,MAAM,QAAQ,QAAQ,GAE7C,OAAO,CAAC,GAAGA,UAAW,GAAG,SAAS;CAEpC,OAAO;AACT,CAAC;;AAGH,MAAM,eAAe,YAAoB,YAAqB,kBAA2B;CAEvF,MAAM,SAAS,UAAU,UAAU;CACnC,IAAI,eAAe,KAAA,GAAW,MAAM,QAAQ,YAAY,QAAQ;CAChE,IAAI,kBAAkB,KAAA,GAAW,MAAM,QAAQ,eAAe,SAAS;CACvE,OAAO;AACT;;;;;AA+BA,MAAa,uBACX,eACkD;CAElD,MAAM,iBAAiB,YAAqB,kBAC1C,YAAY,YAAY,YAAY,aAAa;CAGnD,OAAO;AACT;;;;;AAwBA,MAAa,2BACX,qBACoD;CAEpD,MAAM,qBAAqB,YAAqB,mBAA4B,SAC1E,YAAY,iBAAiB,IAAI,GAAG,YAAY,aAAa;CAG/D,OAAO;AACT"}
|
|
@@ -45,5 +45,4 @@ type MergeObjects<BaseConfig, UserConfig, Depth extends readonly unknown[], M ex
|
|
|
45
45
|
* arrays show only the user's elements.
|
|
46
46
|
*/
|
|
47
47
|
export type MergedConfig<BaseConfig, UserConfig, M extends Mode = "spread"> = MergeObjects<BaseConfig, UserConfig, MaxDepth, M>;
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=merge.types.d.ts.map
|
|
48
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ShellCommand } from "./shell/command.js";
|
|
1
2
|
import { minimalEnv } from "./shell/env.js";
|
|
2
3
|
import { CopyFixtureOptions, copyFixture } from "./fixture.js";
|
|
3
4
|
import { packPackage } from "./pack.js";
|
|
4
|
-
import { ShellCommand } from "./shell/command.js";
|
|
5
5
|
import { Shell, ShellEnv, ShellOptions, ShellResult, createShell } from "./shell/shell.js";
|
|
6
6
|
import { makeTempDir } from "./temp-dir.js";
|
|
7
7
|
export { type CopyFixtureOptions, type Shell, type ShellCommand, type ShellEnv, type ShellOptions, type ShellResult, copyFixture, createShell, makeTempDir, minimalEnv, packPackage };
|
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
* Builds the package at `root` when it has a tsdown config, packs it into a temp dir, and returns the tarball path.
|
|
3
3
|
* Runs once per resolved root for the life of the test process.
|
|
4
4
|
*/
|
|
5
|
-
export declare const packPackage: (root: string) => Promise<string>;
|
|
6
|
-
//# sourceMappingURL=pack.d.ts.map
|
|
5
|
+
export declare const packPackage: (root: string) => Promise<string>;
|
|
@@ -14,5 +14,4 @@ export declare class ShellCommand implements PromiseLike<ShellResult> {
|
|
|
14
14
|
/** Configure the command to not throw an exception on a non-zero exit code. */
|
|
15
15
|
nothrow(): this;
|
|
16
16
|
then<TResult1 = ShellResult, TResult2 = never>(onfulfilled?: ((value: ShellResult) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=command.d.ts.map
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":[],"sources":["../../../src/test-utils/shell/command.ts"],"sourcesContent":["import path from \"node:path\"\n\nimport bun from \"bun\"\nimport type { $ as BunShell } from \"bun\"\n\nimport { addBinDirs } from \"#test-utils/shell/bin-dirs.ts\"\nimport { removeNodeShims } from \"#test-utils/shell/node-shim.ts\"\nimport type { ShellEnv, ShellOptions, ShellResult } from \"#test-utils/shell/shell.ts\"\n\nconst FINAL_NEWLINE = /\\r?\\n$/v\n\nconst stripFinalNewline = (output: Buffer) => output.toString().replace(FINAL_NEWLINE, \"\")\n\n/** Wraps Bun's `ShellPromise` to apply its settings when it runs and return its output as strings. */\nexport class ShellCommand implements PromiseLike<ShellResult> {\n readonly #shellPromise: BunShell.ShellPromise\n readonly #settings: Required<ShellOptions>\n #result: Promise<ShellResult> | undefined\n\n /** Starts from the shell's settings, which the command's own methods can then override. */\n public constructor(shellPromise: BunShell.ShellPromise, settings: Required<ShellOptions>) {\n this.#shellPromise = shellPromise\n // Copy `settings` so this command's changes don't reach the shell.\n this.#settings = { ...settings }\n }\n\n /** Change the working directory for the command. Relative paths resolve against `process.cwd()`. */\n public cwd(newCwd: string) {\n this.#settings.cwd = newCwd\n return this\n }\n\n /** Add environment variables for the command, on top of the shell's. Set one to `undefined` to remove it. */\n public env(newEnv: ShellEnv) {\n this.#settings.env = { ...this.#settings.env, ...newEnv }\n return this\n }\n\n /** Configure whether the command puts `node_modules/.bin` of its cwd and each of its parents first on `PATH`. */\n public localBins(useLocalBins: boolean) {\n this.#settings.localBins = useLocalBins\n return this\n }\n\n /** Configure the command to not throw an exception on a non-zero exit code. */\n public nothrow() {\n this.#settings.throws = false\n return this\n }\n\n // oxlint-disable-next-line unicorn/no-thenable - awaiting a command runs it, like Bun's `ShellPromise`\n public async then<TResult1 = ShellResult, TResult2 = never>(\n onfulfilled?: ((value: ShellResult) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ) {\n // Keep the first run because Bun rejects settings on a command that already started.\n this.#result ??= this.#run()\n return this.#result.then(onfulfilled, onrejected)\n }\n\n async #run(): Promise<ShellResult> {\n const { env, localBins, throws } = this.#settings\n const cwd = path.resolve(this.#settings.cwd)\n const envWithBins = localBins ? addBinDirs(cwd, env) : env\n const finalEnv = removeNodeShims(envWithBins)\n\n const output = await this.#shellPromise\n .cwd(cwd)\n .env(finalEnv)\n .quiet()\n .throws(throws)\n .catch((error: unknown) => {\n if (error instanceof bun.$.ShellError) throw error\n // Name the cwd because Bun's start errors (like a missing cwd) don't.\n throw new Error(`Command failed to start (cwd: ${cwd})`, { cause: error })\n })\n\n return {\n stdout: stripFinalNewline(output.stdout),\n stderr: stripFinalNewline(output.stderr),\n exitCode: output.exitCode,\n }\n }\n}\n"],"mappings":";;;;;AASA,MAAM,gBAAgB;AAEtB,MAAM,qBAAqB,WAAmB,OAAO,SAAS,CAAC,CAAC,QAAQ,eAAe,EAAE;;AAGzF,IAAa,eAAb,MAA8D;CAC5D;CACA;CACA;;CAGA,YAAmB,cAAqC,UAAkC;EACxF,KAAK,gBAAgB;EAErB,KAAK,YAAY,EAAE,GAAG,SAAS;CACjC;;CAGA,IAAW,QAAgB;EACzB,KAAK,UAAU,MAAM;EACrB,OAAO;CACT;;CAGA,IAAW,QAAkB;EAC3B,KAAK,UAAU,MAAM;GAAE,GAAG,KAAK,UAAU;GAAK,GAAG;EAAO;EACxD,OAAO;CACT;;CAGA,UAAiB,cAAuB;EACtC,KAAK,UAAU,YAAY;EAC3B,OAAO;CACT;;CAGA,UAAiB;EACf,KAAK,UAAU,SAAS;EACxB,OAAO;CACT;CAGA,MAAa,KACX,aACA,YACA;EAEA,KAAK,YAAY,KAAK,KAAK;
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../src/test-utils/shell/command.ts"],"sourcesContent":["import path from \"node:path\"\n\nimport bun from \"bun\"\nimport type { $ as BunShell } from \"bun\"\n\nimport { addBinDirs } from \"#test-utils/shell/bin-dirs.ts\"\nimport { removeNodeShims } from \"#test-utils/shell/node-shim.ts\"\nimport type { ShellEnv, ShellOptions, ShellResult } from \"#test-utils/shell/shell.ts\"\n\nconst FINAL_NEWLINE = /\\r?\\n$/v\n\nconst stripFinalNewline = (output: Buffer) => output.toString().replace(FINAL_NEWLINE, \"\")\n\n/** Wraps Bun's `ShellPromise` to apply its settings when it runs and return its output as strings. */\nexport class ShellCommand implements PromiseLike<ShellResult> {\n readonly #shellPromise: BunShell.ShellPromise\n readonly #settings: Required<ShellOptions>\n #result: Promise<ShellResult> | undefined\n\n /** Starts from the shell's settings, which the command's own methods can then override. */\n public constructor(shellPromise: BunShell.ShellPromise, settings: Required<ShellOptions>) {\n this.#shellPromise = shellPromise\n // Copy `settings` so this command's changes don't reach the shell.\n this.#settings = { ...settings }\n }\n\n /** Change the working directory for the command. Relative paths resolve against `process.cwd()`. */\n public cwd(newCwd: string) {\n this.#settings.cwd = newCwd\n return this\n }\n\n /** Add environment variables for the command, on top of the shell's. Set one to `undefined` to remove it. */\n public env(newEnv: ShellEnv) {\n this.#settings.env = { ...this.#settings.env, ...newEnv }\n return this\n }\n\n /** Configure whether the command puts `node_modules/.bin` of its cwd and each of its parents first on `PATH`. */\n public localBins(useLocalBins: boolean) {\n this.#settings.localBins = useLocalBins\n return this\n }\n\n /** Configure the command to not throw an exception on a non-zero exit code. */\n public nothrow() {\n this.#settings.throws = false\n return this\n }\n\n // oxlint-disable-next-line unicorn/no-thenable - awaiting a command runs it, like Bun's `ShellPromise`\n public async then<TResult1 = ShellResult, TResult2 = never>(\n onfulfilled?: ((value: ShellResult) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ) {\n // Keep the first run because Bun rejects settings on a command that already started.\n this.#result ??= this.#run()\n // oxlint-disable-next-line promise/prefer-catch - forward both handlers so `onrejected` doesn't catch errors from `onfulfilled`\n return this.#result.then(onfulfilled, onrejected)\n }\n\n async #run(): Promise<ShellResult> {\n const { env, localBins, throws } = this.#settings\n const cwd = path.resolve(this.#settings.cwd)\n const envWithBins = localBins ? addBinDirs(cwd, env) : env\n const finalEnv = removeNodeShims(envWithBins)\n\n const output = await this.#shellPromise\n .cwd(cwd)\n .env(finalEnv)\n .quiet()\n .throws(throws)\n .catch((error: unknown) => {\n if (error instanceof bun.$.ShellError) throw error\n // Name the cwd because Bun's start errors (like a missing cwd) don't.\n throw new Error(`Command failed to start (cwd: ${cwd})`, { cause: error })\n })\n\n return {\n stdout: stripFinalNewline(output.stdout),\n stderr: stripFinalNewline(output.stderr),\n exitCode: output.exitCode,\n }\n }\n}\n"],"mappings":";;;;;AASA,MAAM,gBAAgB;AAEtB,MAAM,qBAAqB,WAAmB,OAAO,SAAS,CAAC,CAAC,QAAQ,eAAe,EAAE;;AAGzF,IAAa,eAAb,MAA8D;CAC5D;CACA;CACA;;CAGA,YAAmB,cAAqC,UAAkC;EACxF,KAAK,gBAAgB;EAErB,KAAK,YAAY,EAAE,GAAG,SAAS;CACjC;;CAGA,IAAW,QAAgB;EACzB,KAAK,UAAU,MAAM;EACrB,OAAO;CACT;;CAGA,IAAW,QAAkB;EAC3B,KAAK,UAAU,MAAM;GAAE,GAAG,KAAK,UAAU;GAAK,GAAG;EAAO;EACxD,OAAO;CACT;;CAGA,UAAiB,cAAuB;EACtC,KAAK,UAAU,YAAY;EAC3B,OAAO;CACT;;CAGA,UAAiB;EACf,KAAK,UAAU,SAAS;EACxB,OAAO;CACT;CAGA,MAAa,KACX,aACA,YACA;EAEA,KAAK,YAAY,KAAK,KAAK;EAE3B,OAAO,KAAK,QAAQ,KAAK,aAAa,UAAU;CAClD;CAEA,MAAM,OAA6B;EACjC,MAAM,EAAE,KAAK,WAAW,WAAW,KAAK;EACxC,MAAM,MAAM,KAAK,QAAQ,KAAK,UAAU,GAAG;EAC3C,MAAM,cAAc,YAAY,WAAW,KAAK,GAAG,IAAI;EACvD,MAAM,WAAW,gBAAgB,WAAW;EAE5C,MAAM,SAAS,MAAM,KAAK,cACvB,IAAI,GAAG,CAAC,CACR,IAAI,QAAQ,CAAC,CACb,MAAM,CAAC,CACP,OAAO,MAAM,CAAC,CACd,OAAO,UAAmB;GACzB,IAAI,iBAAiB,IAAI,EAAE,YAAY,MAAM;GAE7C,MAAM,IAAI,MAAM,iCAAiC,IAAI,IAAI,EAAE,OAAO,MAAM,CAAC;EAC3E,CAAC;EAEH,OAAO;GACL,QAAQ,kBAAkB,OAAO,MAAM;GACvC,QAAQ,kBAAkB,OAAO,MAAM;GACvC,UAAU,OAAO;EACnB;CACF;AACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ShellEnv } from "./shell.js";
|
|
2
2
|
/** Returns `PATH` and `HOME` from `process.env`, merged with `extra`. */
|
|
3
|
-
export declare const minimalEnv: (extra?: ShellEnv) => ShellEnv;
|
|
4
|
-
//# sourceMappingURL=env.d.ts.map
|
|
3
|
+
export declare const minimalEnv: (extra?: ShellEnv) => ShellEnv;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ShellCommand } from "./command.js";
|
|
2
|
+
import { minimalEnv } from "./env.js";
|
|
2
3
|
import { ShellExpression } from "bun";
|
|
3
4
|
export type ShellEnv = Record<string, string | undefined>;
|
|
4
5
|
export interface ShellOptions {
|
|
@@ -39,4 +40,4 @@ export type Shell = (strings: TemplateStringsArray, ...expressions: ShellExpress
|
|
|
39
40
|
* read the test runner's stdin, so add `< /dev/null` to a command that might prompt.
|
|
40
41
|
*/
|
|
41
42
|
export declare const createShell: (options?: ShellOptions) => Shell;
|
|
42
|
-
|
|
43
|
+
export { type ShellCommand, minimalEnv };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ShellCommand } from "./command.js";
|
|
2
|
+
import { minimalEnv } from "./env.js";
|
|
2
3
|
import process from "node:process";
|
|
3
4
|
import bun from "bun";
|
|
4
5
|
// src/test-utils/shell/shell.ts
|
|
@@ -19,6 +20,6 @@ const createShell = (options = {}) => {
|
|
|
19
20
|
};
|
|
20
21
|
return (strings, ...expressions) => new ShellCommand(bunShell(strings, ...expressions), settings);
|
|
21
22
|
};
|
|
22
|
-
export { createShell };
|
|
23
|
+
export { createShell, minimalEnv };
|
|
23
24
|
|
|
24
25
|
//# sourceMappingURL=shell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","names":[],"sources":["../../../src/test-utils/shell/shell.ts"],"sourcesContent":["import process from \"node:process\"\n\nimport bun from \"bun\"\nimport type { ShellExpression } from \"bun\"\n\nimport { ShellCommand } from \"#test-utils/shell/command.ts\"\n\nexport type ShellEnv = Record<string, string | undefined>\n\nexport interface ShellOptions {\n /**\n * The working directory for commands. Relative paths resolve against `process.cwd()`.\n *\n * @default process.cwd()\n */\n cwd?: string\n /**\n * The environment for commands. Replaces `process.env`.\n *\n * @default process.env without `FORCE_COLOR`\n */\n env?: ShellEnv\n /**\n * Put `node_modules/.bin` of the cwd and each of its parents first on `PATH`.\n *\n * @default true\n */\n localBins?: boolean\n /**\n * Throw Bun's `ShellError` on a non-zero exit code.\n *\n * @default true\n */\n throws?: boolean\n}\n\nexport interface ShellResult {\n stdout: string\n stderr: string\n exitCode: number\n}\n\n/** Runs commands like Bun's `$`, quietly, starting from the shell's options. */\nexport type Shell = (strings: TemplateStringsArray, ...expressions: ShellExpression[]) => ShellCommand\n\n/**\n * Creates a shell that runs each command quietly and returns its output with one trailing newline stripped. Commands\n * read the test runner's stdin, so add `< /dev/null` to a command that might prompt.\n */\nexport const createShell = (options: ShellOptions = {}): Shell => {\n // Use a separate instance so settings on Bun's global `$` don't apply here.\n const bunShell = new bun.$.Shell()\n const settings: Required<ShellOptions> = {\n cwd: options.cwd ?? process.cwd(),\n // Drop `FORCE_COLOR` because `bask` sets it when the tests run in a terminal and CI does not.\n env: options.env ?? { ...process.env, FORCE_COLOR: undefined },\n localBins: options.localBins ?? true,\n throws: options.throws ?? true,\n }\n\n return (strings, ...expressions) => new ShellCommand(bunShell(strings, ...expressions), settings)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.js","names":[],"sources":["../../../src/test-utils/shell/shell.ts"],"sourcesContent":["import process from \"node:process\"\n\nimport bun from \"bun\"\nimport type { ShellExpression } from \"bun\"\n\nimport { ShellCommand } from \"#test-utils/shell/command.ts\"\n\nexport type { ShellCommand } from \"#test-utils/shell/command.ts\"\nexport { minimalEnv } from \"#test-utils/shell/env.ts\"\n\nexport type ShellEnv = Record<string, string | undefined>\n\nexport interface ShellOptions {\n /**\n * The working directory for commands. Relative paths resolve against `process.cwd()`.\n *\n * @default process.cwd()\n */\n cwd?: string\n /**\n * The environment for commands. Replaces `process.env`.\n *\n * @default process.env without `FORCE_COLOR`\n */\n env?: ShellEnv\n /**\n * Put `node_modules/.bin` of the cwd and each of its parents first on `PATH`.\n *\n * @default true\n */\n localBins?: boolean\n /**\n * Throw Bun's `ShellError` on a non-zero exit code.\n *\n * @default true\n */\n throws?: boolean\n}\n\nexport interface ShellResult {\n stdout: string\n stderr: string\n exitCode: number\n}\n\n/** Runs commands like Bun's `$`, quietly, starting from the shell's options. */\nexport type Shell = (strings: TemplateStringsArray, ...expressions: ShellExpression[]) => ShellCommand\n\n/**\n * Creates a shell that runs each command quietly and returns its output with one trailing newline stripped. Commands\n * read the test runner's stdin, so add `< /dev/null` to a command that might prompt.\n */\nexport const createShell = (options: ShellOptions = {}): Shell => {\n // Use a separate instance so settings on Bun's global `$` don't apply here.\n const bunShell = new bun.$.Shell()\n const settings: Required<ShellOptions> = {\n cwd: options.cwd ?? process.cwd(),\n // Drop `FORCE_COLOR` because `bask` sets it when the tests run in a terminal and CI does not.\n env: options.env ?? { ...process.env, FORCE_COLOR: undefined },\n localBins: options.localBins ?? true,\n throws: options.throws ?? true,\n }\n\n return (strings, ...expressions) => new ShellCommand(bunShell(strings, ...expressions), settings)\n}\n"],"mappings":";;;;;;;;;AAoDA,MAAa,eAAe,UAAwB,CAAC,MAAa;CAEhE,MAAM,WAAW,IAAI,IAAI,EAAE,MAAM;CACjC,MAAM,WAAmC;EACvC,KAAK,QAAQ,OAAO,QAAQ,IAAI;EAEhC,KAAK,QAAQ,OAAO;GAAE,GAAG,QAAQ;GAAK,aAAa,KAAA;EAAU;EAC7D,WAAW,QAAQ,aAAa;EAChC,QAAQ,QAAQ,UAAU;CAC5B;CAEA,QAAQ,SAAS,GAAG,gBAAgB,IAAI,aAAa,SAAS,SAAS,GAAG,WAAW,GAAG,QAAQ;AAClG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "My shared configs for TS projects",
|
|
5
5
|
"homepage": "https://github.com/adamhl8/configs",
|
|
6
6
|
"bugs": {
|
|
@@ -59,38 +59,40 @@
|
|
|
59
59
|
"prepare": "bask prepare"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@adamhl8/
|
|
62
|
+
"@adamhl8/oxlint-plugin-clean-modules": "^0.2.0",
|
|
63
|
+
"@adamhl8/oxlint-plugin-package-boundaries": "^0.1.0",
|
|
63
64
|
"@commitlint/config-conventional": "^21.2.4",
|
|
64
65
|
"@commitlint/types": "^21.2.3",
|
|
65
66
|
"@e18e/eslint-plugin": "^0.8.1",
|
|
66
67
|
"arkenv": "^0.12.3",
|
|
67
68
|
"arktype": "^2.2.9",
|
|
68
|
-
"es-toolkit": "^1.53.
|
|
69
|
+
"es-toolkit": "^1.53.2",
|
|
69
70
|
"eslint-plugin-bunisms": "^0.11.0",
|
|
70
|
-
"eslint-plugin-hono": "^1.2.
|
|
71
|
-
"eslint-plugin-react-web-api": "^5.
|
|
72
|
-
"eslint-plugin-react-you-might-not-need-an-effect": "^1.
|
|
71
|
+
"eslint-plugin-hono": "^1.2.2",
|
|
72
|
+
"eslint-plugin-react-web-api": "^5.30.1",
|
|
73
|
+
"eslint-plugin-react-you-might-not-need-an-effect": "^1.2.0",
|
|
73
74
|
"eslint-plugin-regexp": "^3.3.3",
|
|
74
75
|
"oxlint-plugin-directive-comments": "^0.1.0",
|
|
75
76
|
"oxlint-tailwindcss": "^1.17.1",
|
|
76
77
|
"ts-explicit-errors": "^5.0.1",
|
|
77
|
-
"type-fest": "^5.10.0"
|
|
78
|
+
"type-fest": "^5.10.0",
|
|
79
|
+
"verkit": "^0.5.0"
|
|
78
80
|
},
|
|
79
81
|
"devDependencies": {
|
|
80
|
-
"@adamhl8/bask": "^0.6.
|
|
82
|
+
"@adamhl8/bask": "^0.6.1",
|
|
81
83
|
"@adamhl8/configs": "file:.",
|
|
82
84
|
"@arethetypeswrong/core": "^0.18.5",
|
|
83
85
|
"@commitlint/cli": "^21.2.4",
|
|
84
86
|
"@types/bun": "^1.4.4",
|
|
85
|
-
"knip": "^6.
|
|
87
|
+
"knip": "^6.45.0",
|
|
86
88
|
"markdown-toc": "^1.2.0",
|
|
87
|
-
"oxfmt": "^0.
|
|
88
|
-
"oxlint": "^1.
|
|
89
|
-
"oxlint-tsgolint": "^7.0.
|
|
89
|
+
"oxfmt": "^0.78.0",
|
|
90
|
+
"oxlint": "^1.93.0",
|
|
91
|
+
"oxlint-tsgolint": "^7.0.2006",
|
|
90
92
|
"publint": "^0.3.25",
|
|
91
93
|
"release-it": "^21.1.2",
|
|
92
94
|
"release-it-git-cliff": "^0.2.1",
|
|
93
|
-
"tsdown": "^0.23.
|
|
95
|
+
"tsdown": "^0.23.7",
|
|
94
96
|
"typescript": "7.1.0-beta"
|
|
95
97
|
},
|
|
96
98
|
"peerDependencies": {
|
|
@@ -99,16 +101,16 @@
|
|
|
99
101
|
"@commitlint/cli": ">=21.2",
|
|
100
102
|
"@commitlint/config-conventional": ">=21.2",
|
|
101
103
|
"@tailwindcss/language-server": ">=0.16",
|
|
102
|
-
"knip": ">=6.
|
|
104
|
+
"knip": ">=6.45",
|
|
103
105
|
"markdown-toc": ">=1.2",
|
|
104
|
-
"oxfmt": ">=0.
|
|
105
|
-
"oxlint": ">=1.
|
|
106
|
-
"oxlint-tsgolint": ">=7.0.
|
|
106
|
+
"oxfmt": ">=0.78",
|
|
107
|
+
"oxlint": ">=1.93",
|
|
108
|
+
"oxlint-tsgolint": ">=7.0.2006",
|
|
107
109
|
"publint": ">=0.3",
|
|
108
110
|
"release-it": ">=21.1",
|
|
109
111
|
"release-it-git-cliff": ">=0.2",
|
|
110
112
|
"tailwint": ">=1.1",
|
|
111
|
-
"tsdown": ">=0.23.
|
|
113
|
+
"tsdown": ">=0.23.7",
|
|
112
114
|
"typescript": "^7.1.0-beta"
|
|
113
115
|
},
|
|
114
116
|
"peerDependenciesMeta": {
|