@shivaedev/quality 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +19 -17
- package/dist/adapters/ImportCompiler.d.ts +21 -0
- package/dist/adapters/ImportCompiler.d.ts.map +1 -0
- package/dist/adapters/ImportCompiler.js +22 -0
- package/dist/adapters/ImportCompiler.js.map +1 -0
- package/dist/adapters/compileCache.config.d.ts +2 -0
- package/dist/adapters/compileCache.config.d.ts.map +1 -0
- package/dist/adapters/compileCache.config.js +3 -0
- package/dist/adapters/compileCache.config.js.map +1 -0
- package/dist/adapters/imports/browserChecker.d.ts +3 -0
- package/dist/adapters/imports/browserChecker.d.ts.map +1 -0
- package/dist/adapters/imports/browserChecker.js +8 -0
- package/dist/adapters/imports/browserChecker.js.map +1 -0
- package/dist/adapters/imports/departures.d.ts +5 -0
- package/dist/adapters/imports/departures.d.ts.map +1 -0
- package/dist/adapters/imports/departures.js +61 -0
- package/dist/adapters/imports/departures.js.map +1 -0
- package/dist/adapters/imports/graph.d.ts +4 -0
- package/dist/adapters/imports/graph.d.ts.map +1 -0
- package/dist/adapters/imports/graph.js +44 -0
- package/dist/adapters/imports/graph.js.map +1 -0
- package/dist/{imports → adapters/imports}/projects.d.ts +4 -1
- package/dist/adapters/imports/projects.d.ts.map +1 -0
- package/dist/{imports → adapters/imports}/projects.js +42 -17
- package/dist/adapters/imports/projects.js.map +1 -0
- package/dist/{imports → adapters/imports}/resolve.d.ts +3 -10
- package/dist/adapters/imports/resolve.d.ts.map +1 -0
- package/dist/{imports → adapters/imports}/resolve.js +6 -4
- package/dist/adapters/imports/resolve.js.map +1 -0
- package/dist/adapters/knip/entryPointFindings.d.ts +2 -1
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/knip/entryPointFindings.js +7 -6
- package/dist/adapters/knip/entryPointFindings.js.map +1 -1
- package/dist/adapters/knip/run.d.ts +1 -1
- package/dist/adapters/knip/run.d.ts.map +1 -1
- package/dist/adapters/knip/run.js +1 -1
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/manifestInventory.d.ts.map +1 -1
- package/dist/adapters/manifestInventory.js +3 -1
- package/dist/adapters/manifestInventory.js.map +1 -1
- package/dist/adapters/manifestReader.d.ts +2 -2
- package/dist/adapters/manifestReader.d.ts.map +1 -1
- package/dist/adapters/manifestReader.js +2 -1
- package/dist/adapters/manifestReader.js.map +1 -1
- package/dist/adapters/rule.d.ts +9 -0
- package/dist/adapters/rule.d.ts.map +1 -0
- package/dist/adapters/rule.js +35 -0
- package/dist/adapters/rule.js.map +1 -0
- package/dist/adapters/standardSchema.d.ts.map +1 -0
- package/dist/adapters/standardSchema.js.map +1 -0
- package/dist/adapters/testProjects.d.ts.map +1 -1
- package/dist/adapters/testProjects.js +1 -0
- package/dist/adapters/testProjects.js.map +1 -1
- package/dist/biome/report.d.ts +2 -1
- package/dist/biome/report.d.ts.map +1 -1
- package/dist/biome/report.js +11 -5
- package/dist/biome/report.js.map +1 -1
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +3 -1
- package/dist/cli/lint.js.map +1 -1
- package/dist/config/decode.d.ts +2 -2
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +3 -2
- package/dist/config/decode.js.map +1 -1
- package/dist/config/resolve.d.ts +2 -2
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +2 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/config.d.ts +5 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/decoded.d.ts.map +1 -1
- package/dist/decoded.js +1 -1
- package/dist/decoded.js.map +1 -1
- package/dist/engine/runRules.d.ts.map +1 -1
- package/dist/engine/runRules.js +29 -6
- package/dist/engine/runRules.js.map +1 -1
- package/dist/engine/session.d.ts +3 -2
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +9 -6
- package/dist/engine/session.js.map +1 -1
- package/dist/exceptions/biomeFindings.d.ts +3 -0
- package/dist/exceptions/biomeFindings.d.ts.map +1 -1
- package/dist/exceptions/biomeFindings.js +21 -0
- package/dist/exceptions/biomeFindings.js.map +1 -1
- package/dist/hooks/preCommit.js +1 -1
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/imports/Endpoint.d.ts +9 -0
- package/dist/imports/Endpoint.d.ts.map +1 -0
- package/dist/imports/Endpoint.js +2 -0
- package/dist/imports/Endpoint.js.map +1 -0
- package/dist/imports/browserGlobals.d.ts +2 -1
- package/dist/imports/browserGlobals.d.ts.map +1 -1
- package/dist/imports/browserGlobals.js +6 -9
- package/dist/imports/browserGlobals.js.map +1 -1
- package/dist/imports/departures.d.ts +3 -2
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/departures.js +8 -61
- package/dist/imports/departures.js.map +1 -1
- package/dist/imports/extract.d.ts +2 -1
- package/dist/imports/extract.d.ts.map +1 -1
- package/dist/imports/extract.js +11 -10
- package/dist/imports/extract.js.map +1 -1
- package/dist/imports/fences/check.d.ts +3 -2
- package/dist/imports/fences/check.d.ts.map +1 -1
- package/dist/imports/fences/check.js +5 -4
- package/dist/imports/fences/check.js.map +1 -1
- package/dist/imports/fences/compilePolicy.js.map +1 -1
- package/dist/imports/fences/match.d.ts +1 -1
- package/dist/imports/fences/match.d.ts.map +1 -1
- package/dist/imports/fences/match.js.map +1 -1
- package/dist/imports/fences/reach.d.ts +1 -1
- package/dist/imports/fences/reach.d.ts.map +1 -1
- package/dist/imports/fences/vocabulary.d.ts +1 -1
- package/dist/imports/fences/vocabulary.d.ts.map +1 -1
- package/dist/imports/graph.d.ts +6 -4
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/imports/graph.js +17 -53
- package/dist/imports/graph.js.map +1 -1
- package/dist/manifests/sorted.d.ts.map +1 -1
- package/dist/manifests/sorted.js +1 -1
- package/dist/manifests/sorted.js.map +1 -1
- package/dist/rule.d.ts +12 -8
- package/dist/rule.d.ts.map +1 -1
- package/dist/rule.js +8 -31
- package/dist/rule.js.map +1 -1
- package/dist/rules/builtIn.d.ts +1 -1
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +2 -0
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/effect/program.js +1 -1
- package/dist/rules/effect/program.js.map +1 -1
- package/dist/rules/imports/adminPaths.js +1 -1
- package/dist/rules/imports/adminPaths.js.map +1 -1
- package/dist/rules/imports/aliased.d.ts.map +1 -1
- package/dist/rules/imports/aliased.js +3 -2
- package/dist/rules/imports/aliased.js.map +1 -1
- package/dist/rules/imports/cycles.d.ts.map +1 -1
- package/dist/rules/imports/cycles.js +4 -3
- package/dist/rules/imports/cycles.js.map +1 -1
- package/dist/rules/imports/manifest.d.ts.map +1 -1
- package/dist/rules/imports/manifest.js +6 -5
- package/dist/rules/imports/manifest.js.map +1 -1
- package/dist/rules/imports/noTestCode.d.ts.map +1 -1
- package/dist/rules/imports/noTestCode.js +3 -2
- package/dist/rules/imports/noTestCode.js.map +1 -1
- package/dist/rules/imports/resolvable.d.ts.map +1 -1
- package/dist/rules/imports/resolvable.js +10 -7
- package/dist/rules/imports/resolvable.js.map +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +3 -2
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/stories/collectionOrigins.d.ts +1 -1
- package/dist/rules/stories/collectionOrigins.d.ts.map +1 -1
- package/dist/rules/stories/collectionOrigins.js.map +1 -1
- package/dist/rules/stories/engine.d.ts.map +1 -1
- package/dist/rules/stories/engine.js +5 -4
- package/dist/rules/stories/engine.js.map +1 -1
- package/dist/rules/stories/engineOf.d.ts +1 -1
- package/dist/rules/stories/engineOf.d.ts.map +1 -1
- package/dist/rules/stories/globalRetries.d.ts +2 -0
- package/dist/rules/stories/globalRetries.d.ts.map +1 -0
- package/dist/rules/stories/globalRetries.js +45 -0
- package/dist/rules/stories/globalRetries.js.map +1 -0
- package/dist/rules/stories/importOrigin.d.ts +3 -1
- package/dist/rules/stories/importOrigin.d.ts.map +1 -1
- package/dist/rules/stories/importOrigin.js +15 -0
- package/dist/rules/stories/importOrigin.js.map +1 -1
- package/dist/rules/stories/noExpect.d.ts.map +1 -1
- package/dist/rules/stories/noExpect.js +4 -3
- package/dist/rules/stories/noExpect.js.map +1 -1
- package/dist/rules/stories/origins.d.ts.map +1 -1
- package/dist/rules/stories/origins.js +14 -12
- package/dist/rules/stories/origins.js.map +1 -1
- package/dist/rules/stories/retryOption.d.ts +3 -0
- package/dist/rules/stories/retryOption.d.ts.map +1 -0
- package/dist/rules/stories/retryOption.js +37 -0
- package/dist/rules/stories/retryOption.js.map +1 -0
- package/dist/rules/stories/sources.d.ts +1 -1
- package/dist/rules/stories/sources.d.ts.map +1 -1
- package/dist/rules/stories/sources.js +1 -1
- package/dist/rules/stories/sources.js.map +1 -1
- package/dist/rules/stories/specs.d.ts.map +1 -1
- package/dist/rules/stories/specs.js +5 -4
- package/dist/rules/stories/specs.js.map +1 -1
- package/package.json +5 -5
- package/src/adapters/ImportCompiler.ts +30 -0
- package/src/adapters/compileCache.config.ts +3 -0
- package/src/adapters/imports/browserChecker.ts +8 -0
- package/src/adapters/imports/departures.ts +82 -0
- package/src/adapters/imports/graph.ts +48 -0
- package/src/{imports → adapters/imports}/projects.ts +61 -27
- package/src/{imports → adapters/imports}/resolve.ts +9 -10
- package/src/adapters/knip/entryPointFindings.ts +12 -9
- package/src/adapters/knip/run.ts +1 -1
- package/src/adapters/manifestInventory.ts +3 -1
- package/src/adapters/manifestReader.ts +4 -3
- package/src/adapters/rule.ts +53 -0
- package/src/adapters/testProjects.ts +1 -0
- package/src/biome/report.ts +11 -5
- package/src/cli/lint.ts +3 -0
- package/src/config/decode.ts +5 -4
- package/src/config/resolve.ts +7 -6
- package/src/config.ts +7 -5
- package/src/decoded.ts +1 -1
- package/src/engine/runRules.ts +31 -11
- package/src/engine/session.ts +14 -13
- package/src/exceptions/biomeFindings.ts +29 -0
- package/src/hooks/preCommit.ts +1 -1
- package/src/imports/Endpoint.ts +3 -0
- package/src/imports/browserGlobals.ts +6 -10
- package/src/imports/departures.ts +9 -80
- package/src/imports/extract.ts +12 -10
- package/src/imports/fences/check.ts +6 -5
- package/src/imports/fences/compilePolicy.ts +1 -1
- package/src/imports/fences/match.ts +1 -1
- package/src/imports/fences/reach.ts +1 -1
- package/src/imports/fences/vocabulary.ts +1 -1
- package/src/imports/graph.ts +27 -60
- package/src/manifests/sorted.ts +3 -3
- package/src/rule.ts +20 -52
- package/src/rules/builtIn.ts +2 -0
- package/src/rules/effect/program.ts +1 -1
- package/src/rules/imports/adminPaths.ts +1 -1
- package/src/rules/imports/aliased.ts +10 -7
- package/src/rules/imports/cycles.ts +4 -3
- package/src/rules/imports/manifest.ts +8 -5
- package/src/rules/imports/noTestCode.ts +12 -9
- package/src/rules/imports/resolvable.ts +10 -7
- package/src/rules/imports/runtime.ts +3 -2
- package/src/rules/stories/collectionOrigins.ts +13 -1
- package/src/rules/stories/engine.ts +5 -4
- package/src/rules/stories/engineOf.ts +1 -1
- package/src/rules/stories/globalRetries.ts +50 -0
- package/src/rules/stories/importOrigin.ts +17 -0
- package/src/rules/stories/noExpect.ts +4 -3
- package/src/rules/stories/origins.ts +14 -13
- package/src/rules/stories/retryOption.ts +41 -0
- package/src/rules/stories/sources.ts +1 -1
- package/src/rules/stories/specs.ts +5 -4
- package/dist/imports/projects.d.ts.map +0 -1
- package/dist/imports/projects.js.map +0 -1
- package/dist/imports/resolve.d.ts.map +0 -1
- package/dist/imports/resolve.js.map +0 -1
- package/dist/standardSchema.d.ts.map +0 -1
- package/dist/standardSchema.js.map +0 -1
- /package/dist/{standardSchema.d.ts → adapters/standardSchema.d.ts} +0 -0
- /package/dist/{standardSchema.js → adapters/standardSchema.js} +0 -0
- /package/src/{standardSchema.ts → adapters/standardSchema.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.56.0 - 2026-11-02
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- Rule configuration callbacks are strictly typed. Replace heterogeneous `Rule[]` annotations with `RegisteredRule[]`, or use `satisfies readonly RegisteredRule[]` to retain per-rule config inference. Keep each rule's inferred type when configuring it directly, and register local rules with `defineConfig` to validate unknown configuration input.
|
|
8
|
+
- Construct local rules with `defineRule`, which supplies the registry callback; migrate handwritten rule objects to this factory.
|
|
9
|
+
- Import `StandardSchemaV1`, `StandardResult`, `StandardIssue` and `describeIssue` from `@shivaedev/quality/adapters/standardSchema.ts` instead of `@shivaedev/quality/standardSchema.ts`.
|
|
10
|
+
|
|
11
|
+
## 0.55.0 - 2026-11-02
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Report test, suite and story registrations that declare a `retry` option with `tests/global-retries`. Remove local retries so vitest-rerun's global reruns record flakes.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Story kits and the Effect test adapter import native Effect submodules instead of whole barrels. Cookie windows, member windows, React mounting and OTLP decoding load when used; browser RPC imports use dedicated modules.
|
|
20
|
+
- App test workers reuse Node's on-disk compilation cache while keeping Vitest's file isolation.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Interrupting a scan stops its pending manifest reads.
|
|
25
|
+
- Report expected filesystem failures from rules as findings. Report unreadable manifests and manifests removed after discovery under `manifests/valid`; keep optional missing-file lookups unchanged.
|
|
26
|
+
- Report tsconfig diagnostics as import findings and honor configured module resolution, path aliases and package export conditions, including NodeNext import and require branches.
|
|
27
|
+
- Accept local rules that require custom Effect services in `defineConfig`, while preserving their rule IDs and schema input types.
|
|
28
|
+
- Refuse empty Biome selections with a Quality repair message for both `quality lint` and `quality fix` on Biome 2.6.3.
|
|
29
|
+
- Reject stale Biome lint and assist exceptions during `quality lint`, naming the file/rule pair to remove from the selected Quality config.
|
|
30
|
+
|
|
31
|
+
### Breaking
|
|
32
|
+
|
|
33
|
+
- `manifestReader` requires an Effect scope so its reads stop when the owning operation ends. Consumers must create and use the reader within `Effect.scoped`.
|
|
34
|
+
- `ImportGraph` includes required `configFindings` metadata. Consumers constructing graphs themselves must supply this array (`configFindings: []` when there are no diagnostics); graphs returned by `importGraph` already include it.
|
|
35
|
+
|
|
3
36
|
## 0.54.0 - 2026-11-01
|
|
4
37
|
|
|
5
38
|
### Added
|
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ The work has three parts: connect the repository to the shared tools once; descr
|
|
|
30
30
|
|
|
31
31
|
### Rule lifecycle
|
|
32
32
|
|
|
33
|
-
`defineRule` accepts synchronous, Promise and Effect checks. Promise checks receive an abort signal as `context.signal`; pass it to cancellable APIs. Effect checks compose filesystem and child-process work in the run's scope. An optional `validate(context)` callback returns inventory-dependent configuration issues before `check`; those issues stop the run as invalid configuration. Configured checks return Effects and preserve their service requirements; tool checks read `FileSystem` and `ChildProcessSpawner` from the environment.
|
|
33
|
+
`defineRule` accepts synchronous, Promise and Effect checks. Its callbacks use the schema's decoded option type, while `configure` and config settings use its input type. Use `RegisteredRule` for a list of rules with different option types; each rule keeps its strict callback types. The adapter validates unknown registry input and bridges checks to Effects. Promise checks receive an abort signal as `context.signal`; pass it to cancellable APIs. Effect checks compose filesystem and child-process work in the run's scope. An optional `validate(context)` callback returns inventory-dependent configuration issues before `check`; those issues stop the run as invalid configuration. Configured checks return Effects and preserve their service requirements; tool checks read `FileSystem` and `ChildProcessSpawner` from the environment.
|
|
34
34
|
|
|
35
|
-
Interrupting a run stops its Biome and knip processes and removes their scoped temporary configs before it ends. A rule crash is a defect; the CLI prints the rule id and original stack. Expected setup failures retain their underlying cause without including it in enumerable error data.
|
|
35
|
+
Interrupting a run stops pending manifest reads and its Biome and knip processes and removes their scoped temporary configs before it ends. Expected filesystem failures in rules become findings that name the affected file. A rule crash is a defect; the CLI prints the rule id and original stack. Expected setup failures retain their underlying cause without including it in enumerable error data.
|
|
36
36
|
|
|
37
37
|
### Effect boundaries and services
|
|
38
38
|
|
|
@@ -177,7 +177,7 @@ export default [uiBoundary];
|
|
|
177
177
|
|
|
178
178
|
This is `packages/ui/quality.fences.config.ts`; paths remain relative to the repository root. Fences supplied through `rules["imports/fences"].options.fences` join the same policy. This adds a fact about the repository's architecture to the shared import check. It does not select a different set of Quality rules. Every file named in either chain must exist in the checked tree; a deleted file stops the run. Use `external()` for external targets. The chains demonstrate hypothetical imports between those files; they need not be actual imports. The illegal chain must cross this fence alone; the legal chain must cross none. `mayNotImport` checks direct imports; `mayNotReach` also follows repository imports transitively; `mayImportOnly(...subjects).of(unit)` permits only named modules or folders of a unit. A source exception such as `.from(folders("packages/ui/src").except(files("packages/ui/src/testClient.ts")))` admits that one file while its siblings remain fenced. Fences count type imports but never hold test files or files under `test-support/`. The default `imports/no-test-code` rule rejects production imports of either, including type imports and re-exports. Move shared code into a production module that tests can import.
|
|
179
179
|
|
|
180
|
-
The import rules resolve every literal specifier the
|
|
180
|
+
The import rules resolve every literal specifier with the nearest `tsconfig.json`, or the project it references that includes the file. They preserve the compiler's resolution settings, inherited path aliases and package export conditions, including NodeNext's import and require branches. `imports/resolvable` reports config syntax errors, invalid options and unreadable extended or referenced configs as findings on the config file; repair those before relying on import findings. Without a tsconfig, Quality uses bundler resolution with the `source` condition. The run stops when the sources hold no module at all. A relative or `#` import of a file that a generator writes before the tests run resolves only inside a folder that `imports/resolvable` lists as `generated`; the folder, or every file an import names in it, must be ignored by git:
|
|
181
181
|
|
|
182
182
|
```ts
|
|
183
183
|
import { defineConfig } from "@shivaedev/quality/config.ts";
|
|
@@ -195,6 +195,8 @@ Quality's `tests/story-specs` rule reports a test file that declares tests witho
|
|
|
195
195
|
|
|
196
196
|
Quality's `tests/story-engine` rule reports a kit story with no traits whose body never references its verbs, its story or its test context. Drive the engine through one of the kit's verbs or traits, or, if the code under test is pure, move it to `<stem>.unit.test.ts`, which reaches no engine and mocks nothing. The rule follows the same kit origins and prerequisite exemptions as `tests/story-specs`; unit and typecheck files are exempt.
|
|
197
197
|
|
|
198
|
+
`tests/global-retries` reports a `retry` option on a test, suite or kit story registration, including `retry: 0`. Remove the option: retries are global only and recorded by vitest-rerun so flakes stay visible. The rule follows registrar imports, aliases and modifiers, and options declared as literals, shared variables or spreads. Runner configuration and Effect retry schedules are accepted. It checks registrations throughout the inventory, including unit tests and test-support files, with no story prerequisite exemptions.
|
|
199
|
+
|
|
198
200
|
There is one other honest form. A pure function with no engine behind it gets a plain test in a **unit test** file, declared by the `unit` modifier: `parse.unit.test.ts` beside `parse.ts`, or `<behaviour>.unit.spec.ts`. A unit test exercises one unit and reaches nothing bigger, so `tests/story-specs` rejects a `.unit` file that reaches an engine, directly or through what it imports, following runtime imports through the shared import graph; type-only imports do not count. The engines are Node's file, network, process and worker modules, database clients, HTTP and socket libraries, DOM libraries and the story runners. A test-support fixture the unit file imports must pass the same check. The rule also rejects mocking (`vi.mock`, `vi.spyOn`, `vi.fn`, env and global stubs, fake timers), providing services (`Effect.provide*`, `Layer`, `ManagedRuntime`, `it.layer`) and DOM use in the unit file and its test-support fixtures. Running an Effect that needs nothing, such as with `Effect.runSync` or `it.effect`, is fine. When the module under test reaches an engine, the finding names the import chain and asks you to split the module: move the pure code into a module that reaches no engine and test that one. The static check reads imports and syntax. The runtime guard in `testProjects` catches I/O hidden inside an external package or a global such as `fetch` when a unit test runs.
|
|
199
201
|
|
|
200
202
|
Every finding names both repairs: drive the engine through the package's story kit, or, when the code under test is pure, move the test to a `.unit` file. Never wrap a pure function in a story that ignores its kit.
|
|
@@ -291,7 +293,7 @@ For adoption, run `quality baseline write --rule code/unused --file src/legacy.t
|
|
|
291
293
|
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` accepts a file named after its single exported constant, such as `liveQueryWindow.ts` exporting `const liveQueryWindow`. It keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. Inside a module’s `client/admin/` or `server/admin/` subtree, file names may repeat words from above `admin/`: `src/modules/inbox/client/admin/inboxRoutes.ts` may export `inboxRoutes`. Names must still match their exports and omit words repeated by folders within the admin subtree. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
292
294
|
- **React:** `react/jsx-conditionals` reports `&&` and ternaries in the JSX children a component returns, including nested decisions and returned `.map` items. Decisions in a `const` above the return, JSX built inside library callbacks and conditional attributes are accepted. A ternary with two plain string or number literal branches, such as `{on ? "On" : "Off"}`, is accepted; branches that select JSX, components or computed values still need a decision before the JSX. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
|
|
293
295
|
- **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
|
|
294
|
-
- **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path.
|
|
296
|
+
- **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. An unreadable manifest or one removed after discovery becomes a `manifests/valid` finding. Optional lookups still treat `NotFound` as absence. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members with exports. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `source`, `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. `manifests/application` keeps an application on its entry points, as described above.
|
|
295
297
|
- **Biome:** the `biome` rule reports Biome's error findings as `biome/<category>`. A Biome run that fails without an error finding, such as one whose config leaves no file to check, fails lint and fix with Biome's message. The preset leaves out the `.worktrees` folder at the root, so a checkout does not lint its linked worktrees, while a worktree inside it lints all of its own files. The preset's plugins ban ambient time, randomness, `console` and `process.env` in favour of Effect's services.
|
|
296
298
|
|
|
297
299
|
### Decide before JSX
|
|
@@ -386,18 +388,18 @@ function List({ items }) {
|
|
|
386
388
|
|
|
387
389
|
Import names from their defining module; there is no root entry. The package's `./*.ts` export pattern also exposes the gate's implementation modules; the following table lists the config, tool and extension entry points:
|
|
388
390
|
|
|
389
|
-
| Module | Exports
|
|
390
|
-
| ----------------------------- |
|
|
391
|
-
| `config.ts` | `defineConfig`, `QualityConfig`, `Level` (`"error"`), `RuleSetting`, `RuleSettings`, `BuiltInRules`
|
|
392
|
-
| `rule.ts` | `defineRule`, `Rule`, `Configured`, `Finding`, `Findings`, `SourceFile`, `RuleInputs`, `RuleContext` |
|
|
393
|
-
| `standardSchema.ts`
|
|
394
|
-
| `imports/fence.ts` | `fence`
|
|
395
|
-
| `imports/fences/selectors.ts` | `packages`, `folders`, `files`, `modules`, `scopes`, `anyOf`, `workspace`, `anything`, `external`
|
|
396
|
-
| `imports/fences/model.ts` | `Fence`, `Target`, `Selector`, `Prohibition`, `Examples`, `Chain`, `ExampleStep`, `External`
|
|
397
|
-
| `adapters/testProjects.ts` | `testProjects`, `TestProjectsOptions`
|
|
398
|
-
| `appViteConfig.ts` | `appViteConfig`
|
|
399
|
-
| `appTestConfig.ts` | `appTestConfig`
|
|
400
|
-
| `naming/testName.ts` | `testName`, `isTestCode`, `isTestSupport`, `ENVIRONMENTS`, `Environment`, `TestName`
|
|
391
|
+
| Module | Exports |
|
|
392
|
+
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
393
|
+
| `config.ts` | `defineConfig`, `QualityConfig`, `Level` (`"error"`), `RuleSetting`, `RuleSettings`, `BuiltInRules` |
|
|
394
|
+
| `rule.ts` | `defineRule`, `Rule`, `RegisteredRule`, `Configured`, `Finding`, `Findings`, `SourceFile`, `RuleInputs`, `RuleContext` |
|
|
395
|
+
| `adapters/standardSchema.ts` | `StandardSchemaV1`, `StandardResult`, `StandardIssue`, `describeIssue` |
|
|
396
|
+
| `imports/fence.ts` | `fence` |
|
|
397
|
+
| `imports/fences/selectors.ts` | `packages`, `folders`, `files`, `modules`, `scopes`, `anyOf`, `workspace`, `anything`, `external` |
|
|
398
|
+
| `imports/fences/model.ts` | `Fence`, `Target`, `Selector`, `Prohibition`, `Examples`, `Chain`, `ExampleStep`, `External` |
|
|
399
|
+
| `adapters/testProjects.ts` | `testProjects`, `TestProjectsOptions` |
|
|
400
|
+
| `appViteConfig.ts` | `appViteConfig` |
|
|
401
|
+
| `appTestConfig.ts` | `appTestConfig` |
|
|
402
|
+
| `naming/testName.ts` | `testName`, `isTestCode`, `isTestSupport`, `ENVIRONMENTS`, `Environment`, `TestName` |
|
|
401
403
|
|
|
402
404
|
#### Config
|
|
403
405
|
|
|
@@ -497,7 +499,7 @@ import { appTestConfig } from "@shivaedev/quality/appTestConfig.ts";
|
|
|
497
499
|
export default appTestConfig();
|
|
498
500
|
```
|
|
499
501
|
|
|
500
|
-
Use this in `vitest.config.ts`. It composes `testProjects` with browser and server resolution and inlines the `@shivaedev` packages for the test server, since an application imports each framework piece by its own name. Both helpers accept extra export conditions for workspace development: `appViteConfig(plugins, ["source"])` and `appTestConfig(["source"])`. Published apps use the defaults.
|
|
502
|
+
Use this in `vitest.config.ts`. It composes `testProjects` with browser and server resolution and inlines the `@shivaedev` packages for the test server, since an application imports each framework piece by its own name. Its `testProjects` defaults enable Node’s on-disk compilation cache in workers to reuse compiled dependencies while Vitest keeps module state isolated between files. Node’s `NODE_DISABLE_COMPILE_CACHE=1` disables that cache. Both helpers accept extra export conditions for workspace development: `appViteConfig(plugins, ["source"])` and `appTestConfig(["source"])`. Published apps use the defaults.
|
|
501
503
|
|
|
502
504
|
For Vitest, install `vitest`, and add `@shivaedev/test-story` and `happy-dom` when the repository has DOM tests, then use:
|
|
503
505
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type ts from "typescript";
|
|
3
|
+
import type { WorkspacePackage } from "#imports/workspace.ts";
|
|
4
|
+
import type { RuleInputs } from "#rule.ts";
|
|
5
|
+
declare const ImportAnalysisFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly _tag: "ImportAnalysisFailure";
|
|
7
|
+
} & Readonly<A>;
|
|
8
|
+
export declare class ImportAnalysisFailure extends ImportAnalysisFailure_base<{
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly root: string;
|
|
11
|
+
}> {
|
|
12
|
+
}
|
|
13
|
+
export declare const ImportCompiler: import("effect/Context").Service<"@shivaedev/quality/ImportCompiler", Readonly<{
|
|
14
|
+
readonly browserChecker: (source: ts.SourceFile) => Effect.Effect<ts.TypeChecker, never, never>;
|
|
15
|
+
readonly departures: (inputs: RuleInputs, packages: readonly WorkspacePackage[]) => Effect.Effect<readonly import("../imports/departures.ts").Departure[], ImportAnalysisFailure, never>;
|
|
16
|
+
readonly graph: (inputs: RuleInputs) => Effect.Effect<Pick<import("../imports/graph.ts").ImportGraph, "configFindings" | "edges" | "modules" | "unresolved">, ImportAnalysisFailure, never>;
|
|
17
|
+
}>> & {
|
|
18
|
+
readonly layer: import("effect/Layer").Layer<"@shivaedev/quality/ImportCompiler", never, never>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=ImportCompiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportCompiler.d.ts","sourceRoot":"","sources":["../../src/adapters/ImportCompiler.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAKjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;;;;AAE3C,qBAAa,qBAAsB,SAAQ,2BAA0C;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC;CAAG;AAML,eAAO,MAAM,cAAc;;;;;;CAUzB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { Data, Effect } from "effect";
|
|
3
|
+
import { defineService } from "@shivaedev/service/defineService.ts";
|
|
4
|
+
import { browserChecker } from "#adapters/imports/browserChecker.ts";
|
|
5
|
+
import { departures } from "#adapters/imports/departures.ts";
|
|
6
|
+
import { graph } from "#adapters/imports/graph.ts";
|
|
7
|
+
export class ImportAnalysisFailure extends Data.TaggedError("ImportAnalysisFailure") {
|
|
8
|
+
}
|
|
9
|
+
function failure(root, cause) {
|
|
10
|
+
return new ImportAnalysisFailure({ message: `Cannot analyze imports in ${root}: ${cause instanceof Error ? cause.message : String(cause)}`, root });
|
|
11
|
+
}
|
|
12
|
+
export const ImportCompiler = defineService({
|
|
13
|
+
id: "@shivaedev/quality/ImportCompiler",
|
|
14
|
+
initialize: Effect.void,
|
|
15
|
+
methods: () => ({
|
|
16
|
+
browserChecker: (source) => Effect.sync(() => browserChecker(source)),
|
|
17
|
+
departures: (inputs, packages) => Effect.try({ catch: (cause) => failure(inputs.root, cause), try: () => departures(inputs, packages) }),
|
|
18
|
+
graph: (inputs) => Effect.try({ catch: (cause) => failure(inputs.root, cause), try: () => graph(inputs, realpathSync(inputs.root)) }),
|
|
19
|
+
}),
|
|
20
|
+
requires: [],
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=ImportCompiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportCompiler.js","sourceRoot":"","sources":["../../src/adapters/ImportCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iC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J,CAAC;IACF,QAAQ,EAAE,EAAE;CACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compileCache.config.d.ts","sourceRoot":"","sources":["../../src/adapters/compileCache.config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compileCache.config.js","sourceRoot":"","sources":["../../src/adapters/compileCache.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserChecker.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/browserChecker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,WAAW,CAKpE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export function browserChecker(source) {
|
|
3
|
+
const options = { allowJs: true, noLib: true, noResolve: true };
|
|
4
|
+
const host = ts.createCompilerHost(options);
|
|
5
|
+
host.getSourceFile = (path) => (path === source.fileName ? source : undefined);
|
|
6
|
+
return ts.createProgram([source.fileName], options, host).getTypeChecker();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=browserChecker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserChecker.js","sourceRoot":"","sources":["../../../src/adapters/imports/browserChecker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,UAAU,cAAc,CAAC,MAAqB;IACnD,MAAM,OAAO,GAAuB,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACpF,MAAM,IAAI,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/E,OAAO,EAAE,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Departure } from "#imports/departures.ts";
|
|
2
|
+
import { type WorkspacePackage } from "#imports/workspace.ts";
|
|
3
|
+
import type { RuleInputs } from "#rule.ts";
|
|
4
|
+
export declare function departures(inputs: RuleInputs, packages: readonly WorkspacePackage[]): readonly Departure[];
|
|
5
|
+
//# sourceMappingURL=departures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/departures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA8D3C,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,SAAS,EAAE,CAY1G"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
import { specifierSites } from "#imports/specifiers.ts";
|
|
4
|
+
import { packageOf } from "#imports/workspace.ts";
|
|
5
|
+
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
6
|
+
import { parse } from "#rules/parse.ts";
|
|
7
|
+
import { projectsFor } from "./projects.js";
|
|
8
|
+
import { resolveImport } from "./resolve.js";
|
|
9
|
+
const QUERY = /\?.*$/u;
|
|
10
|
+
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
11
|
+
const MAY_BE_RELATIVE = /["'`]\.\.?[/"'`]|\\/u;
|
|
12
|
+
const TRAILING_SLASHES = /\/+$/u;
|
|
13
|
+
function noAmbient() {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
function leavesLexically(path) {
|
|
17
|
+
const normal = posix.normalize(path).replace(TRAILING_SLASHES, "");
|
|
18
|
+
return normal === ".." || normal.startsWith("../") || normal.includes("/");
|
|
19
|
+
}
|
|
20
|
+
function registersAdmin(from, specifier, target) {
|
|
21
|
+
const root = moduleRoot(from);
|
|
22
|
+
const folder = posix.dirname(from);
|
|
23
|
+
return (root !== undefined
|
|
24
|
+
&& (folder === `${root}/client` || folder === `${root}/server`)
|
|
25
|
+
&& /^registration\.[cm]?[jt]sx?$/u.test(posix.basename(from))
|
|
26
|
+
&& specifier.startsWith("./admin/")
|
|
27
|
+
&& target?.startsWith(`${folder}/admin/`) === true);
|
|
28
|
+
}
|
|
29
|
+
// A relative import leaves its folder when its path climbs or descends, or when it names a folder whose index file lies below.
|
|
30
|
+
function departureAt(context, site) {
|
|
31
|
+
const path = site.specifier.replace(QUERY, "");
|
|
32
|
+
if (!RELATIVE.test(path)) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const request = { kind: "import", line: site.line, specifier: site.specifier, type: site.type };
|
|
36
|
+
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
37
|
+
const local = target?.kind === "file" ? target.path : undefined;
|
|
38
|
+
if (registersAdmin(context.path, path, local)) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
if (!(leavesLexically(path) || (local !== undefined && posix.dirname(local) !== posix.dirname(context.path)))) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const owner = local === undefined ? undefined : packageOf(context.packages, local);
|
|
45
|
+
const workspace = owner !== undefined && owner !== packageOf(context.packages, context.path) ? owner.name : undefined;
|
|
46
|
+
return { ...site, file: context.path, installed: target?.kind === "external" ? target.package : undefined, workspace };
|
|
47
|
+
}
|
|
48
|
+
export function departures(inputs, packages) {
|
|
49
|
+
const root = realpathSync(inputs.root);
|
|
50
|
+
const projectOf = projectsFor(root);
|
|
51
|
+
return inputs.sources.flatMap((file) => {
|
|
52
|
+
const syntax = MAY_BE_RELATIVE.test(file.text) ? parse(file) : undefined;
|
|
53
|
+
if (syntax === undefined) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const from = posix.join(root, file.path);
|
|
57
|
+
const context = { from, packages, path: file.path, project: projectOf(from), root };
|
|
58
|
+
return specifierSites(syntax).flatMap((site) => departureAt(context, site) ?? []);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=departures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"departures.js","sourceRoot":"","sources":["../../../src/adapters/imports/departures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAsB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAyB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEnC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,MAA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,CAAC,MAAkB,EAAE,QAAqC;IACnF,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACX,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;QACpF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ImportGraph } from "#imports/graph.ts";
|
|
2
|
+
import type { RuleInputs } from "#rule.ts";
|
|
3
|
+
export declare function graph(inputs: RuleInputs, root: string): Pick<ImportGraph, "configFindings" | "edges" | "modules" | "unresolved">;
|
|
4
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/graph.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAkB3C,wBAAgB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC,CAwBhI"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { join, posix } from "node:path";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { ambientModules } from "#imports/ambient.ts";
|
|
4
|
+
import { importsOf } from "#imports/extract.ts";
|
|
5
|
+
import { parse } from "#rules/parse.ts";
|
|
6
|
+
import { projectsFor } from "./projects.js";
|
|
7
|
+
import { isDeclarationFile, presumedTarget, resolveImport } from "./resolve.js";
|
|
8
|
+
const QUERY = /\?.*$/u;
|
|
9
|
+
function relativeTarget(from, request) {
|
|
10
|
+
const relative = request.kind === "path-reference" || request.specifier.startsWith("./") || request.specifier.startsWith("../");
|
|
11
|
+
return relative ? posix.join(posix.dirname(from), request.specifier.replace(QUERY, "")) : undefined;
|
|
12
|
+
}
|
|
13
|
+
// A relative import or a package import of a missing file still names a path, so fences see it before its generator writes it.
|
|
14
|
+
function missingTarget(root, from, request, project) {
|
|
15
|
+
const target = presumedTarget(root, request, join(root, from), project) ?? relativeTarget(from, request);
|
|
16
|
+
return target === undefined || target.startsWith("../") ? undefined : target;
|
|
17
|
+
}
|
|
18
|
+
export function graph(inputs, root) {
|
|
19
|
+
const projectOf = projectsFor(root);
|
|
20
|
+
const parsed = inputs.sources.flatMap((file) => {
|
|
21
|
+
const syntax = parse(file);
|
|
22
|
+
return syntax === undefined ? [] : [{ file, path: join(root, file.path), syntax }];
|
|
23
|
+
});
|
|
24
|
+
const ambient = ambientModules(parsed);
|
|
25
|
+
const edges = [];
|
|
26
|
+
const unresolved = [];
|
|
27
|
+
for (const { file, path, syntax } of parsed) {
|
|
28
|
+
const project = projectOf(path);
|
|
29
|
+
syntax.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, undefined, ts.sys, project.options);
|
|
30
|
+
for (const request of importsOf(syntax, isDeclarationFile(file.path), project.options)) {
|
|
31
|
+
const to = resolveImport(root, ambient, request, path, project);
|
|
32
|
+
if (to === undefined) {
|
|
33
|
+
const missing = missingTarget(root, file.path, request, project);
|
|
34
|
+
unresolved.push({ ...request, from: file.path, missing });
|
|
35
|
+
edges.push(...(missing === undefined ? [] : [{ ...request, from: file.path, to: { kind: "file", path: missing } }]));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
edges.push({ ...request, from: file.path, to });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { configFindings: projectOf.findings, edges, modules: parsed.map(({ file }) => file.path), unresolved };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/adapters/imports/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAsB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB,SAAS,cAAc,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,KAAK,gBAAgB,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CA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D,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;AAChH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
+
import type { Findings } from "#rule.ts";
|
|
2
3
|
export interface Project {
|
|
3
4
|
readonly cache: ts.ModuleResolutionCache;
|
|
4
5
|
readonly files: ReadonlySet<string>;
|
|
@@ -6,5 +7,7 @@ export interface Project {
|
|
|
6
7
|
readonly typesCache: ts.ModuleResolutionCache;
|
|
7
8
|
readonly typesOptions: ts.CompilerOptions;
|
|
8
9
|
}
|
|
9
|
-
export declare function projectsFor(root: string): (file: string) => Project
|
|
10
|
+
export declare function projectsFor(root: string): ((file: string) => Project) & {
|
|
11
|
+
readonly findings: Findings;
|
|
12
|
+
};
|
|
10
13
|
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,qBAAqB,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,eAAe,CAAC;CAC1C;AA0FD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAuCvG"}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import { dirname, join, relative } from "node:path";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
const CONFIG = "tsconfig.json";
|
|
4
|
-
const SOURCE_CONDITION = "source";
|
|
5
|
-
const quietHost = { ...ts.sys, onUnRecoverableConfigFileDiagnostic: () => undefined };
|
|
6
4
|
function resolutionOptions(options, declarations) {
|
|
7
5
|
return {
|
|
8
6
|
...options,
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
noDtsResolution: !declarations,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function projectOf(root, parsed) {
|
|
11
|
+
const options = parsed?.options ?? {
|
|
11
12
|
allowJs: true,
|
|
12
|
-
customConditions: [
|
|
13
|
+
customConditions: ["source"],
|
|
13
14
|
module: ts.ModuleKind.ESNext,
|
|
14
15
|
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
15
|
-
noDtsResolution: !declarations,
|
|
16
16
|
resolveJsonModule: true,
|
|
17
|
-
resolvePackageJsonExports: true,
|
|
18
|
-
resolvePackageJsonImports: true,
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const runtime = resolutionOptions(parsed?.options ?? {}, false);
|
|
23
|
-
const types = resolutionOptions(parsed?.options ?? {}, true);
|
|
18
|
+
const runtime = resolutionOptions(options, false);
|
|
19
|
+
const types = resolutionOptions(options, true);
|
|
24
20
|
return {
|
|
25
21
|
cache: ts.createModuleResolutionCache(root, (file) => file, runtime),
|
|
26
22
|
files: parsed?.files ?? new Set(),
|
|
@@ -29,8 +25,24 @@ function projectOf(root, parsed) {
|
|
|
29
25
|
typesOptions: types,
|
|
30
26
|
};
|
|
31
27
|
}
|
|
32
|
-
function parse(path) {
|
|
33
|
-
const parsed = ts.getParsedCommandLineOfConfigFile(path, {},
|
|
28
|
+
function parse(path, report) {
|
|
29
|
+
const parsed = ts.getParsedCommandLineOfConfigFile(path, {}, {
|
|
30
|
+
...ts.sys,
|
|
31
|
+
onUnRecoverableConfigFileDiagnostic: (diagnostic) => report(diagnostic, path),
|
|
32
|
+
readFile: (file) => {
|
|
33
|
+
const contents = ts.sys.readFile(file);
|
|
34
|
+
if (contents !== undefined) {
|
|
35
|
+
const diagnostic = ts.parseConfigFileTextToJson(file, contents).error;
|
|
36
|
+
if (diagnostic !== undefined) {
|
|
37
|
+
report(diagnostic, file);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return contents;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
for (const diagnostic of parsed?.errors ?? []) {
|
|
44
|
+
report(diagnostic, path);
|
|
45
|
+
}
|
|
34
46
|
return {
|
|
35
47
|
files: new Set(parsed?.fileNames ?? []),
|
|
36
48
|
key: path,
|
|
@@ -60,7 +72,20 @@ function memo(compute) {
|
|
|
60
72
|
}
|
|
61
73
|
// A file resolves with the options of the project that includes it: the nearest tsconfig.json, or a project it references.
|
|
62
74
|
export function projectsFor(root) {
|
|
63
|
-
const
|
|
75
|
+
const findings = [];
|
|
76
|
+
const reported = new Set();
|
|
77
|
+
const parsedAt = memo((path) => parse(path, (diagnostic, config) => {
|
|
78
|
+
const file = relative(root, diagnostic.file?.fileName ?? config).replaceAll("\\", "/");
|
|
79
|
+
const line = diagnostic.file !== undefined && diagnostic.start !== undefined
|
|
80
|
+
? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start).line + 1
|
|
81
|
+
: undefined;
|
|
82
|
+
const message = `TS${diagnostic.code}: ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")} Repair the tsconfig before trusting import findings.`;
|
|
83
|
+
const key = `${file}:${line}:${message}`;
|
|
84
|
+
if (!reported.has(key)) {
|
|
85
|
+
reported.add(key);
|
|
86
|
+
findings.push({ file, line, message, subject: `TS${diagnostic.code}` });
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
64
89
|
function withReferences(path, seen) {
|
|
65
90
|
if (seen.has(path)) {
|
|
66
91
|
return [];
|
|
@@ -71,13 +96,13 @@ export function projectsFor(root) {
|
|
|
71
96
|
}
|
|
72
97
|
const familyAt = memo((config) => withReferences(config, new Set()));
|
|
73
98
|
const projects = new Map();
|
|
74
|
-
return (file) => {
|
|
99
|
+
return Object.assign((file) => {
|
|
75
100
|
const config = nearestConfig(root, file);
|
|
76
101
|
const owner = config === undefined ? undefined : (familyAt(config).find((candidate) => candidate.files.has(file)) ?? parsedAt(config));
|
|
77
102
|
const key = owner?.key ?? "";
|
|
78
103
|
const project = projects.get(key) ?? projectOf(root, owner);
|
|
79
104
|
projects.set(key, project);
|
|
80
105
|
return project;
|
|
81
|
-
};
|
|
106
|
+
}, { findings });
|
|
82
107
|
}
|
|
83
108
|
//# sourceMappingURL=projects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../src/adapters/imports/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,YAAY,CAAC;AAkB5B,MAAM,MAAM,GAAG,eAAe,CAAC;AAE/B,SAAS,iBAAiB,CAAC,OAA2B,EAAE,YAAqB;IAC5E,OAAO;QACN,GAAG,OAAO;QACV,eAAe,EAAE,CAAC,YAAY;KAC9B,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,MAAiC;IACjE,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI;QAClC,OAAO,EAAE,IAAI;QACb,gBAAgB,EAAE,CAAC,QAAQ,CAAC;QAC5B,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM;QAC5B,gBAAgB,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO;QACjD,iBAAiB,EA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"}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type { Ambient } from "
|
|
2
|
-
import type {
|
|
1
|
+
import type { Ambient } from "#imports/ambient.ts";
|
|
2
|
+
import type { Endpoint } from "#imports/Endpoint.ts";
|
|
3
|
+
import type { ImportRequest } from "#imports/extract.ts";
|
|
3
4
|
import type { Project } from "./projects.ts";
|
|
4
|
-
export type Endpoint = {
|
|
5
|
-
readonly kind: "file";
|
|
6
|
-
readonly path: string;
|
|
7
|
-
} | {
|
|
8
|
-
readonly kind: "external";
|
|
9
|
-
readonly package: string;
|
|
10
|
-
readonly specifier: string;
|
|
11
|
-
};
|
|
12
5
|
export declare function isDeclarationFile(path: string): boolean;
|
|
13
6
|
export declare function presumedTarget(root: string, request: ImportRequest, from: string, project: Project): string | undefined;
|
|
14
7
|
export declare function resolveImport(root: string, ambient: Ambient, request: ImportRequest, from: string, project: Project): Endpoint | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AA8B7C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AA8BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOvH;AAYD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAY1I"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
+
import { builtinName, nameAt, packageNameOf } from "#imports/packageName.ts";
|
|
4
5
|
import { posix } from "#inventory/ignoreScope.ts";
|
|
5
|
-
import { builtinName, nameAt, packageNameOf } from "./packageName.js";
|
|
6
6
|
const NODE_MODULES = "/node_modules/";
|
|
7
7
|
const ASSET_DECLARATION = /\.d(?<extension>\.[^./]+)\.ts$/u;
|
|
8
8
|
const DECLARATION = /\.d\.[cm]?ts$/u;
|
|
@@ -40,8 +40,9 @@ function located(request, from, project) {
|
|
|
40
40
|
const path = join(dirname(from), specifier);
|
|
41
41
|
return ts.sys.fileExists(path) ? path : undefined;
|
|
42
42
|
}
|
|
43
|
-
return (ts.resolveModuleName(specifier, from, project.options, ts.sys, project.cache).resolvedModule?.resolvedFileName
|
|
44
|
-
?? ts.resolveModuleName(specifier, from, project.typesOptions, assetHost, project.typesCache).resolvedModule
|
|
43
|
+
return (ts.resolveModuleName(specifier, from, project.options, ts.sys, project.cache, undefined, request.mode).resolvedModule?.resolvedFileName
|
|
44
|
+
?? ts.resolveModuleName(specifier, from, project.typesOptions, assetHost, project.typesCache, undefined, request.mode).resolvedModule
|
|
45
|
+
?.resolvedFileName);
|
|
45
46
|
}
|
|
46
47
|
function resolvedPath(request, from, project) {
|
|
47
48
|
const path = located(request, from, project);
|
|
@@ -51,7 +52,8 @@ export function presumedTarget(root, request, from, project) {
|
|
|
51
52
|
if (request.kind !== "import" || !request.specifier.startsWith(PACKAGE_IMPORT)) {
|
|
52
53
|
return undefined;
|
|
53
54
|
}
|
|
54
|
-
const path = ts.resolveModuleName(request.specifier.replace(QUERY, ""), from, project.options, presumingHost)
|
|
55
|
+
const path = ts.resolveModuleName(request.specifier.replace(QUERY, ""), from, project.options, presumingHost, undefined, undefined, request.mode)
|
|
56
|
+
.resolvedModule?.resolvedFileName;
|
|
55
57
|
return path === undefined ? undefined : posix(relative(root, path));
|
|
56
58
|
}
|
|
57
59
|
function endpointAt(root, specifier, path) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/adapters/imports/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGlD,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAEtC,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAE5D,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,MAAM,aAAa,GAA4B;IAC9C,GAAG,EAAE,CAAC,GAAG;IACT,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI;IAC3B,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;CACnF,CAAC;AAEF,SAAS,OAAO,CAAC,WAAmB;IACnC,OAAO,WAAW,CAAC,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC/D,CAAC;AAED,gJAAgJ;AAChJ,MAAM,SAAS,GAA4B;IAC1C,GAAG,EAAE,CA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OAAO,EAAE,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC;QAC/C,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;QAC/F,CAAC,CAAC,SAAS,CAAC;AACd,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
1
2
|
import type { Findings, RuleInputs } from "#rule.ts";
|
|
2
|
-
export declare
|
|
3
|
+
export declare const entryPointFindings: (inputs: RuleInputs, findings: Findings) => Effect.Effect<import("#rule.ts").Finding[], import("../ImportCompiler.ts").ImportAnalysisFailure, never>;
|
|
3
4
|
//# sourceMappingURL=entryPointFindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entryPointFindings.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entryPointFindings.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUhC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOrD,eAAO,MAAM,kBAAkB,sJA2D7B,CAAC"}
|