@shivaedev/quality 0.66.0 → 0.67.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/CHANGELOG.md +19 -0
- package/README.md +10 -8
- package/biome/declarations.json +7 -1
- package/biome/preset.json +7 -1
- package/dist/adapters/asymmetricMatcher.d.ts +3 -0
- package/dist/adapters/asymmetricMatcher.d.ts.map +1 -0
- package/dist/adapters/asymmetricMatcher.js +27 -0
- package/dist/adapters/asymmetricMatcher.js.map +1 -0
- package/dist/adapters/buildEntryPaths.d.ts +3 -0
- package/dist/adapters/buildEntryPaths.d.ts.map +1 -0
- package/dist/adapters/buildEntryPaths.js +48 -0
- package/dist/adapters/buildEntryPaths.js.map +1 -0
- package/dist/adapters/buildEntryValue.d.ts +4 -0
- package/dist/adapters/buildEntryValue.d.ts.map +1 -0
- package/dist/adapters/buildEntryValue.js +47 -0
- package/dist/adapters/buildEntryValue.js.map +1 -0
- package/dist/adapters/bundlerEntries.d.ts +3 -0
- package/dist/adapters/bundlerEntries.d.ts.map +1 -0
- package/dist/adapters/bundlerEntries.js +49 -0
- package/dist/adapters/bundlerEntries.js.map +1 -0
- package/dist/adapters/callbackEscapes.d.ts +3 -0
- package/dist/adapters/callbackEscapes.d.ts.map +1 -0
- package/dist/adapters/callbackEscapes.js +24 -0
- package/dist/adapters/callbackEscapes.js.map +1 -0
- package/dist/adapters/composedContext.d.ts +3 -0
- package/dist/adapters/composedContext.d.ts.map +1 -0
- package/dist/adapters/composedContext.js +42 -0
- package/dist/adapters/composedContext.js.map +1 -0
- package/dist/adapters/containerDependency.d.ts +4 -0
- package/dist/adapters/containerDependency.d.ts.map +1 -0
- package/dist/adapters/containerDependency.js +28 -0
- package/dist/adapters/containerDependency.js.map +1 -0
- package/dist/adapters/contextCaptureFindings.d.ts.map +1 -1
- package/dist/adapters/contextCaptureFindings.js +3 -1
- package/dist/adapters/contextCaptureFindings.js.map +1 -1
- package/dist/adapters/foreignResources.d.ts +3 -0
- package/dist/adapters/foreignResources.d.ts.map +1 -0
- package/dist/adapters/foreignResources.js +80 -0
- package/dist/adapters/foreignResources.js.map +1 -0
- package/dist/adapters/frameworkCallback.d.ts +4 -0
- package/dist/adapters/frameworkCallback.d.ts.map +1 -0
- package/dist/adapters/frameworkCallback.js +92 -0
- package/dist/adapters/frameworkCallback.js.map +1 -0
- package/dist/adapters/frameworkOwner.d.ts +3 -0
- package/dist/adapters/frameworkOwner.d.ts.map +1 -0
- package/dist/adapters/frameworkOwner.js +35 -0
- package/dist/adapters/frameworkOwner.js.map +1 -0
- package/dist/adapters/importedCall.d.ts +6 -0
- package/dist/adapters/importedCall.d.ts.map +1 -0
- package/dist/adapters/importedCall.js +26 -0
- package/dist/adapters/importedCall.js.map +1 -0
- package/dist/adapters/isToolConfig.d.ts +2 -0
- package/dist/adapters/isToolConfig.d.ts.map +1 -0
- package/dist/adapters/isToolConfig.js +7 -0
- package/dist/adapters/isToolConfig.js.map +1 -0
- package/dist/adapters/knip/configuration.d.ts +1 -1
- package/dist/adapters/knip/configuration.d.ts.map +1 -1
- package/dist/adapters/knip/configuration.js +5 -3
- package/dist/adapters/knip/configuration.js.map +1 -1
- package/dist/adapters/knip/run.d.ts.map +1 -1
- package/dist/adapters/knip/run.js +3 -1
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/localFunctions.d.ts +3 -0
- package/dist/adapters/localFunctions.d.ts.map +1 -0
- package/dist/adapters/localFunctions.js +20 -0
- package/dist/adapters/localFunctions.js.map +1 -0
- package/dist/adapters/pureReader.d.ts +3 -0
- package/dist/adapters/pureReader.d.ts.map +1 -0
- package/dist/adapters/pureReader.js +52 -0
- package/dist/adapters/pureReader.js.map +1 -0
- package/dist/adapters/reachableBuildEntries.d.ts +5 -0
- package/dist/adapters/reachableBuildEntries.d.ts.map +1 -0
- package/dist/adapters/reachableBuildEntries.js +52 -0
- package/dist/adapters/reachableBuildEntries.js.map +1 -0
- package/dist/adapters/readConfig.js +1 -1
- package/dist/adapters/readConfig.js.map +1 -1
- package/dist/adapters/scriptPaths.d.ts +2 -0
- package/dist/adapters/scriptPaths.d.ts.map +1 -0
- package/dist/adapters/scriptPaths.js +5 -0
- package/dist/adapters/scriptPaths.js.map +1 -0
- package/dist/adapters/serviceStateProblems.d.ts.map +1 -1
- package/dist/adapters/serviceStateProblems.js +26 -14
- package/dist/adapters/serviceStateProblems.js.map +1 -1
- package/dist/adapters/specReaderSources.d.ts +7 -0
- package/dist/adapters/specReaderSources.d.ts.map +1 -0
- package/dist/adapters/specReaderSources.js +73 -0
- package/dist/adapters/specReaderSources.js.map +1 -0
- package/dist/cli/args.js +2 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/fix.d.ts +0 -1
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +1 -1
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/limits.d.ts +2 -0
- package/dist/cli/limits.d.ts.map +1 -0
- package/dist/cli/limits.js +2 -0
- package/dist/cli/limits.js.map +1 -0
- package/dist/cli/{options.d.ts → misplaced.d.ts} +1 -1
- package/dist/cli/misplaced.d.ts.map +1 -0
- package/dist/cli/{options.js → misplaced.js} +1 -1
- package/dist/cli/misplaced.js.map +1 -0
- package/dist/cli/program.js +1 -1
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/subcommands.d.ts +2 -0
- package/dist/cli/subcommands.d.ts.map +1 -0
- package/dist/cli/subcommands.js +6 -0
- package/dist/cli/subcommands.js.map +1 -0
- package/dist/cli/{messages.d.ts → usage.d.ts} +1 -2
- package/dist/cli/usage.d.ts.map +1 -0
- package/{src/cli/messages.ts → dist/cli/usage.js} +1 -6
- package/dist/cli/usage.js.map +1 -0
- package/dist/config/defaultExtensions.d.ts +2 -0
- package/dist/config/defaultExtensions.d.ts.map +1 -0
- package/{src/config/constants.ts → dist/config/defaultExtensions.js} +1 -2
- package/dist/config/defaultExtensions.js.map +1 -0
- package/dist/config/file.d.ts +2 -0
- package/dist/config/file.d.ts.map +1 -0
- package/dist/config/file.js +2 -0
- package/dist/config/file.js.map +1 -0
- package/dist/config/load.js +1 -1
- package/dist/config/load.js.map +1 -1
- package/dist/hooks/install.js +1 -1
- package/dist/hooks/install.js.map +1 -1
- package/dist/imports/testComposition.d.ts +4 -0
- package/dist/imports/testComposition.d.ts.map +1 -0
- package/dist/imports/testComposition.js +38 -0
- package/dist/imports/testComposition.js.map +1 -0
- package/dist/inventory/programmaticEntries.d.ts +4 -0
- package/dist/inventory/programmaticEntries.d.ts.map +1 -0
- package/dist/inventory/programmaticEntries.js +9 -0
- package/dist/inventory/programmaticEntries.js.map +1 -0
- package/dist/naming/adapters/plainData.d.ts +5 -0
- package/dist/naming/adapters/plainData.d.ts.map +1 -0
- package/dist/naming/adapters/plainData.js +77 -0
- package/dist/naming/adapters/plainData.js.map +1 -0
- package/dist/naming/constantModule.d.ts +3 -0
- package/dist/naming/constantModule.d.ts.map +1 -0
- package/dist/naming/constantModule.js +25 -0
- package/dist/naming/constantModule.js.map +1 -0
- package/dist/naming/{migrationFile.d.ts → isMigrationFile.d.ts} +1 -1
- package/dist/naming/isMigrationFile.d.ts.map +1 -0
- package/dist/naming/{migrationFile.js → isMigrationFile.js} +1 -1
- package/dist/naming/isMigrationFile.js.map +1 -0
- package/dist/naming/ownExports.d.ts +0 -1
- package/dist/naming/ownExports.d.ts.map +1 -1
- package/dist/naming/ownExports.js +11 -25
- package/dist/naming/ownExports.js.map +1 -1
- package/dist/naming/packageTests.d.ts +7 -0
- package/dist/naming/packageTests.d.ts.map +1 -0
- package/dist/naming/packageTests.js +21 -0
- package/dist/naming/packageTests.js.map +1 -0
- package/dist/naming/testCode.d.ts +4 -0
- package/dist/naming/testCode.d.ts.map +1 -0
- package/dist/naming/testCode.js +46 -0
- package/dist/naming/testCode.js.map +1 -0
- package/dist/rules/comments/kinds.js +1 -1
- package/dist/rules/comments/kinds.js.map +1 -1
- package/dist/rules/effect/contextCapture.js +1 -1
- package/dist/rules/effect/contextCapture.js.map +1 -1
- package/dist/rules/effect/program.d.ts +1 -0
- package/dist/rules/effect/program.d.ts.map +1 -1
- package/dist/rules/effect/program.js +17 -1
- package/dist/rules/effect/program.js.map +1 -1
- package/dist/rules/effect/serviceCatalog.d.ts.map +1 -1
- package/dist/rules/effect/serviceCatalog.js +10 -2
- package/dist/rules/effect/serviceCatalog.js.map +1 -1
- package/dist/rules/effect/serviceFindings.d.ts.map +1 -1
- package/dist/rules/effect/serviceFindings.js +33 -7
- package/dist/rules/effect/serviceFindings.js.map +1 -1
- package/dist/rules/effect/serviceOrigin.d.ts.map +1 -1
- package/dist/rules/effect/serviceOrigin.js +13 -1
- package/dist/rules/effect/serviceOrigin.js.map +1 -1
- package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
- package/dist/rules/effect/serviceParameters.js +12 -12
- package/dist/rules/effect/serviceParameters.js.map +1 -1
- package/dist/rules/effect/serviceTypes.d.ts.map +1 -1
- package/dist/rules/effect/serviceTypes.js +5 -1
- package/dist/rules/effect/serviceTypes.js.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +36 -23
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/imports/manifest.d.ts.map +1 -1
- package/dist/rules/imports/manifest.js +9 -11
- 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 +13 -9
- package/dist/rules/imports/noTestCode.js.map +1 -1
- package/dist/rules/maxLines.d.ts.map +1 -1
- package/dist/rules/maxLines.js +7 -2
- package/dist/rules/maxLines.js.map +1 -1
- package/dist/rules/stories/specHelpers.d.ts.map +1 -1
- package/dist/rules/stories/specHelpers.js +8 -4
- package/dist/rules/stories/specHelpers.js.map +1 -1
- package/dist/rules/suppressions/{directives.d.ts → in.d.ts} +1 -1
- package/dist/rules/suppressions/in.d.ts.map +1 -0
- package/dist/rules/suppressions/{directives.js → in.js} +1 -1
- package/dist/rules/suppressions/in.js.map +1 -0
- package/dist/rules/suppressions/noInline.js +1 -1
- package/dist/rules/suppressions/noInline.js.map +1 -1
- package/dist/rules/test-names/colocated.d.ts.map +1 -1
- package/dist/rules/test-names/colocated.js +7 -4
- package/dist/rules/test-names/colocated.js.map +1 -1
- package/dist/rules/test-names/follow.d.ts.map +1 -1
- package/dist/rules/test-names/follow.js +13 -6
- package/dist/rules/test-names/follow.js.map +1 -1
- package/package.json +4 -3
- package/src/adapters/asymmetricMatcher.ts +33 -0
- package/src/adapters/buildEntryPaths.ts +52 -0
- package/src/adapters/buildEntryValue.ts +52 -0
- package/src/adapters/bundlerEntries.ts +53 -0
- package/src/adapters/callbackEscapes.ts +32 -0
- package/src/adapters/composedContext.ts +48 -0
- package/src/adapters/containerDependency.ts +40 -0
- package/src/adapters/contextCaptureFindings.ts +3 -1
- package/src/adapters/foreignResources.ts +83 -0
- package/src/adapters/frameworkCallback.ts +106 -0
- package/src/adapters/frameworkOwner.ts +41 -0
- package/src/adapters/importedCall.ts +27 -0
- package/src/adapters/isToolConfig.ts +10 -0
- package/src/adapters/knip/configuration.ts +5 -7
- package/src/adapters/knip/run.ts +3 -1
- package/src/adapters/localFunctions.ts +22 -0
- package/src/adapters/pureReader.ts +56 -0
- package/src/adapters/reachableBuildEntries.ts +58 -0
- package/src/adapters/readConfig.ts +1 -1
- package/src/adapters/scriptPaths.ts +5 -0
- package/src/adapters/serviceStateProblems.ts +42 -17
- package/src/adapters/specReaderSources.ts +77 -0
- package/src/cli/args.ts +2 -2
- package/src/cli/fix.ts +1 -2
- package/src/cli/limits.ts +1 -0
- package/src/cli/program.ts +1 -1
- package/src/cli/subcommands.ts +5 -0
- package/{dist/cli/messages.js → src/cli/usage.ts} +0 -6
- package/{dist/config/constants.js → src/config/defaultExtensions.ts} +0 -2
- package/src/config/file.ts +1 -0
- package/src/config/load.ts +1 -1
- package/src/hooks/install.ts +1 -1
- package/src/imports/testComposition.ts +47 -0
- package/src/inventory/programmaticEntries.ts +10 -0
- package/src/naming/adapters/plainData.ts +88 -0
- package/src/naming/constantModule.ts +28 -0
- package/src/naming/ownExports.ts +11 -28
- package/src/naming/packageTests.ts +24 -0
- package/src/naming/testCode.ts +62 -0
- package/src/rules/comments/kinds.ts +1 -1
- package/src/rules/effect/contextCapture.ts +1 -1
- package/src/rules/effect/program.ts +19 -1
- package/src/rules/effect/serviceCatalog.ts +12 -2
- package/src/rules/effect/serviceFindings.ts +38 -7
- package/src/rules/effect/serviceOrigin.ts +14 -1
- package/src/rules/effect/serviceParameters.ts +13 -14
- package/src/rules/effect/serviceTypes.ts +11 -1
- package/src/rules/files/namedAfterExport.ts +46 -23
- package/src/rules/imports/manifest.ts +18 -10
- package/src/rules/imports/noTestCode.ts +13 -12
- package/src/rules/maxLines.ts +7 -3
- package/src/rules/stories/specHelpers.ts +14 -4
- package/src/rules/suppressions/noInline.ts +1 -1
- package/src/rules/test-names/colocated.ts +7 -4
- package/src/rules/test-names/follow.ts +13 -6
- package/dist/adapters/initializerDependency.d.ts +0 -3
- package/dist/adapters/initializerDependency.d.ts.map +0 -1
- package/dist/adapters/initializerDependency.js +0 -53
- package/dist/adapters/initializerDependency.js.map +0 -1
- package/dist/cli/messages.d.ts.map +0 -1
- package/dist/cli/messages.js.map +0 -1
- package/dist/cli/options.d.ts.map +0 -1
- package/dist/cli/options.js.map +0 -1
- package/dist/config/constants.d.ts +0 -3
- package/dist/config/constants.d.ts.map +0 -1
- package/dist/config/constants.js.map +0 -1
- package/dist/naming/migrationFile.d.ts.map +0 -1
- package/dist/naming/migrationFile.js.map +0 -1
- package/dist/rules/suppressions/directives.d.ts.map +0 -1
- package/dist/rules/suppressions/directives.js.map +0 -1
- package/src/adapters/initializerDependency.ts +0 -57
- /package/src/cli/{options.ts → misplaced.ts} +0 -0
- /package/src/naming/{migrationFile.ts → isMigrationFile.ts} +0 -0
- /package/src/rules/suppressions/{directives.ts → in.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.67.1 - 2026-11-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Distinguish owned service state and adapter resources from captured environment dependencies, check local service plumbing, and accept environments assembled from Layers at composition roots.
|
|
8
|
+
- Reuse service analysis across parameter checks to avoid repeated traversal of shared types and declarations.
|
|
9
|
+
|
|
10
|
+
## 0.67.0 - 2026-11-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Classify package-owned `test/` trees beside `src/` and private workspace packages consumed only by tests as development code for dependency, test-import and line-limit checks. Production consumers keep composition packages in the production boundary.
|
|
15
|
+
- Recognise package-owned test suites as covering their package's source tree, and allow pure matchers and readers beside specs while keeping setup and action helpers in story kits.
|
|
16
|
+
|
|
17
|
+
### Breaking
|
|
18
|
+
|
|
19
|
+
- Name plain-data constants modules in camelCase for words every constant shares, or use `limits.ts` for max/min/limit constants and `defaults.ts` for default constants. Rename single-constant PascalCase files such as `ProfileKey.ts` to `profileKey.ts`; split unrelated constants or group heterogeneous copy in one named record. Rename files whose names came from a private constant or an extra constant beside their one other runtime export to match that export. The same rules apply to test-support kits; computed values, schemas, Layers and functions do not count as constants.
|
|
20
|
+
- Direct module imports move from `config/constants.ts` to `config/file.ts` or `config/defaultExtensions.ts`, from `cli/messages.ts` to `cli/usage.ts` or `cli/subcommands.ts`, from `cli/options.ts` to `cli/misplaced.ts`, from `naming/migrationFile.ts` to `naming/isMigrationFile.ts`, and from `rules/suppressions/directives.ts` to `rules/suppressions/in.ts`. Import `MAX_FIX_ROUNDS` from `cli/limits.ts` instead of `cli/fix.ts`.
|
|
21
|
+
|
|
3
22
|
## 0.66.0 - 2026-11-05
|
|
4
23
|
|
|
5
24
|
### Breaking
|
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ Within Effect code, folders named `adapters/` or `test-support/`, at any depth,
|
|
|
122
122
|
|
|
123
123
|
The `ambient-runtime` Biome plugin also reports `Effect.run*` calls whose computation contains `Clock`, `Config` or `Random`, `currentTimeMillisUnsafe`, crypto UUIDs and bytes, `performance.now`, process arguments, working directory and exit state, `globalThis.process.env`, timeouts and microtasks. Yield service computations in the caller's Effect so its environment controls them. These additional checks apply to core TypeScript code. They accept `cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, modules that call `runMain`, use `NodeRuntime.runMain` or guard execution with `fileURLToPath(import.meta.url) === process.argv[1]`, tool configs, tests, `adapters/` and `test-support/`. The existing `Date.now()`, `new Date()`, `Math.random()`, console and direct `process.env` bans still apply there.
|
|
124
124
|
|
|
125
|
-
`effect/service-parameters` reports parameters carrying a service in exported functions and public methods, including returned factories. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Within Effect code, `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
|
|
125
|
+
`effect/service-parameters` reports parameters carrying a service in exported and local functions and public methods, including returned factories. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Within Effect code, `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Callbacks whose arguments are supplied by their owner keep those arguments; wrapping and returning a callback as a runtime operation still checks it. Test-kit registrations do not turn plain kit state into runtime service plumbing. Type predicates inspect service values without declaring a runtime dependency. Owned fibers, closeable scopes and native atom evaluation contexts follow Effect’s lifecycle conventions; wrapping a function with `Effect.fn` still checks its parameters. An adapter may pass a foreign resource between its functions when the calls supply values constructed through an outside library, including an Effect acquisition wrapper; reading that resource from the environment still counts as service plumbing. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
|
|
126
126
|
|
|
127
127
|
Both rules refuse config exceptions and inline suppressions. Record existing debt with `quality baseline write --rule effect/boundary --file src/legacy.ts` and `quality baseline write --rule effect/service-parameters --file src/legacy.ts`; the normal report and baseline burn-down apply.
|
|
128
128
|
|
|
@@ -136,11 +136,11 @@ Import and local aliases, string literals and templates without substitutions ar
|
|
|
136
136
|
|
|
137
137
|
### Service assemblies
|
|
138
138
|
|
|
139
|
-
`effect/service-definition-assembly` keeps top-level `defineService` declarations as operation inventories. List `id`, `requires`, `initialize` and `methods` directly. Import a named initializer Effect or use `Effect.void`; the methods arrow returns a literal record of imported named operations. A state factory may capture only owned lifetime state. `genericMethod` can wrap either form. Keep implementation bodies in focused files outside the assembly. `effect/service-model` follows each inventory entry, including state factory returns and piped bodies, to require `Effect.fn("Service.operation")`, with the service name taken from the last segment of its id. Keep each exported operation in its own sibling file, following the repository's filename conventions, including folder prefixes. It
|
|
139
|
+
`effect/service-definition-assembly` keeps top-level `defineService` declarations as operation inventories. List `id`, `requires`, `initialize` and `methods` directly. Import a named initializer Effect or use `Effect.void`; the methods arrow returns a literal record of imported named operations. A state factory may capture only owned lifetime state. `genericMethod` can wrap either form. Keep implementation bodies in focused files outside the assembly. `effect/service-model` follows each inventory entry, including state factory returns and piped bodies, to require `Effect.fn("Service.operation")`, with the service name taken from the last segment of its id. Keep each exported operation in its own sibling file, following the repository's filename conventions, including folder prefixes. It follows initializer values and returned closures to distinguish owned resources from dependencies: repositories, SQL clients, HTTP clients and configuration belong in `requires` and are yielded inside operations. Initializers hold owned scopes, acquired handles, caches, refs and locks, closures over those resources, and context data captured at setup, such as a caller id or the data-only value of a native `SessionUser`, `Subject` or `Identity` tag. Caller tags are identified by their original declaration names, so import aliases preserve that role; a callable capability inside a caller value remains a dependency. The Layer registration chooses their lifetime.
|
|
140
140
|
|
|
141
141
|
`effect/service-folders` applies wherever a file declares `defineService`, as well as to conventional `services/<name>` folders. Each service has its own folder. Its declaration belongs in `service.ts` with one named service export, beside its operation files. A second declaration beside an existing `service.ts` belongs in a separate service folder.
|
|
142
142
|
|
|
143
|
-
`effect/context-capture` rejects `Effect.provideContext`, `runPromiseWith` and `runForkWith` calls in core code, including imported aliases and destructured runners. It also checks the native Context overload of `Effect.provide`; Layer provision stays available. Yield the environment instead of capturing and re-providing it; runtime bridges belong in `adapters/` or `test-support/`. These service rules permit no config exceptions or inline suppressions. To adopt the policy in an existing repository, review retained findings and record them with `quality baseline write --first-adoption --rule effect/service-model --rule effect/service-folders --rule effect/context-capture`.
|
|
143
|
+
`effect/context-capture` rejects `Effect.provideContext`, `runPromiseWith` and `runForkWith` calls in core code, including imported aliases and destructured runners. It also checks the native Context overload of `Effect.provide`; Layer provision stays available. Composition roots and full-application test harnesses may close over contexts built from Layers, or capture an environment inside an application whose requirements are fully provided by Layers. This follows the construction rather than the filename or folder; an ambient context in an ordinary service remains a finding. Yield the environment instead of capturing and re-providing it; runtime bridges belong in `adapters/` or `test-support/`. These service rules permit no config exceptions or inline suppressions. To adopt the policy in an existing repository, review retained findings and record them with `quality baseline write --first-adoption --rule effect/service-model --rule effect/service-folders --rule effect/context-capture`.
|
|
144
144
|
|
|
145
145
|
The rule reports hidden configurations and method records, configuration and operation spreads, computed members, local implementations and inline bodies, including in adapters and tests. It takes no config exceptions or inline suppressions. See the [service guide](https://github.com/ShivaeDev/platform/tree/main/packages/service#1-assemble-the-service-from-focused-files) for the shape.
|
|
146
146
|
|
|
@@ -267,6 +267,8 @@ Tooling is server code in every package, including the workspace root: files und
|
|
|
267
267
|
|
|
268
268
|
The manifest owns ordinary workspace dependencies. An **application** is a package whose manifest depends on `@shivaedev/platform`, the dependency shell that brings every runtime piece of the ShivaeDev framework. It imports each piece by its own name without listing it: `imports/manifest` and the `biome` rule's undeclared-dependency check count an import as declared when an entry point the application declares lists the piece among its dependencies. `@shivaedev/platform` is the entry point for any code and `@shivaedev/test-story` for test code, tooling and test support only. When a private package's import would be covered by an entry point it lacks, the finding names the entry point to add. `manifests/application` asks an application for `publicHoistPattern: ["@shivaedev/*"]` in the nearest `pnpm-workspace.yaml`, searching upward from the package, because pnpm does not link the pieces where the application can resolve them otherwise. It also rejects a dependency entry beside the entry point that already brings it, such as `@shivaedev/sql` beside `@shivaedev/platform`, and names the entry to remove. A library never depends on platform, so it declares every piece it imports.
|
|
269
269
|
|
|
270
|
+
Quality classifies a package's own `test/**` tree beside `src/` as test code for `imports/manifest`, `imports/no-test-code` and `structure/max-lines`. Helpers there may use development dependencies and the test line cap, while production imports of those helpers still fail. A private workspace package is test composition when it is reached from tests and every external consumer is test code or another test-composition package. Package names and paths do not determine this role. Published packages, packages with a `bin` entry or a source or built module named in a non-test script, and private packages without test consumers remain production code; any production consumer, including a type import, restores production classification through the composition chain. Scripts named `test` or `test:*` remain test entry points.
|
|
271
|
+
|
|
270
272
|
When a package promises more, put `quality.fences.config.ts` beside its `package.json`, exporting an array of fences as the default. Quality discovers this file at the repository root and in workspace packages, even when `sources` includes only their source folders. The root config does not list boundary files.
|
|
271
273
|
|
|
272
274
|
A **fence** is a prohibition on imports, with a reason and one illegal and one legal example. Quality validates all discovered fences together, so duplicate names or contradictory examples stop the run. An unreadable file or invalid default export also stops the run. The `imports/fences` rule checks them with Quality's shared import graph, resolver and report.
|
|
@@ -327,7 +329,7 @@ Every package tests its real engine through its own story kit, so setup and acti
|
|
|
327
329
|
|
|
328
330
|
Quality's `tests/story-setup` rule reports top-level test functions named with the words `seed`, `make`, `build` or `setup`, and fixture-writing calls imported from Node's `fs` or `fs/promises`. It leaves source and `test-support/` files alone. This is a check for those syntax patterns; a passing test file still needs review of what it tests.
|
|
329
331
|
|
|
330
|
-
Specs keep expectations visible. `tests/spec-helpers`
|
|
332
|
+
Specs keep expectations visible. `tests/spec-helpers` keeps setup and action helpers in the kit; pure matchers and readers may stay beside their specs. It recognises property reads and non-mutating methods that TypeScript resolves to native collections and strings, and Vitest’s imported asymmetric matcher factories such as `expect.objectContaining`. It still reports mutation, asynchronous work and unknown calls; `tests/no-expect-in-support` moves `expect` calls into the spec, except in test-support files that register tests at module top level and are not imported by any module, so nested Vitest runs can execute them as test files with real assertions. `tests/named-values` rejects numeric literals passed to `toBe` or `toHaveLength` in specs, except zero and process exit codes asserted on an `exitCode` subject: assert the observed items or use a domain name that comes from the story's inputs or the product. For HTTP statuses, import `* as HttpStatus` from `effect/http/HttpStatus` and use `HttpStatus.fromLiteral("NotFound")`; subjects named `status` or `code` do not exempt numeric assertions. A spec-local numeric const that only feeds these matchers is reported, including aliases for zero and codes. `tests/no-limit-imports` rejects importing `MAX_*` constants from a `limits` module into specs, so a story proves behavior instead of copying an implementation cap.
|
|
331
333
|
|
|
332
334
|
Three more rules keep a spec readable as a story, as the [story-testing skill](https://github.com/ShivaeDev/platform/blob/main/packages/skills/skills/story-testing/SKILL.md) describes. Together with `tests/spec-helpers`, `tests/named-values` and `tests/no-limit-imports`, they read files whose test declarations trace to a story kit, whatever their suffix: a `.test` or `.spec` file outside `test-support` that is not a type or unit test, such as `orders.spec.ts`, `pane.dom.test.ts` or `orders.slow.test.ts`. The suffix says where a test sits under `tests/follow`, not whether it is a story, and `tests/story-specs` already holds every such file to the story kit. They exempt the same test-story prerequisites as `tests/story-specs`. `tests/domain-outcomes` reports each use of Effect's `Exit`, `Cause` or `Result` module, each `_tag` read or destructuring, and each object literal tagged `"Success"` or `"Failure"`: the kit's verb or readout returns the outcome in the domain's words, such as `"unauthorized"`, and a trait builds any failing input. A domain's own tagged value, such as `{ _tag: "Resync" }`, passes. `tests/grouped-outcomes` reports each run of two or more consecutive `expect(yield* …)` statements once, at its first statement: write the outcomes as rows of one `outcomes` call.
|
|
333
335
|
|
|
@@ -405,7 +407,7 @@ Git calls `quality baseline merge <ancestor> <current> <other>`. Entries are key
|
|
|
405
407
|
|
|
406
408
|
### Unused code
|
|
407
409
|
|
|
408
|
-
`code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
|
|
410
|
+
`code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. It follows package scripts through their imports to esbuild `build`, `buildSync` and `context` calls and `Bun.build`, reading literal entry lists or maps, local constants and Node path `join` / `resolve` calls. Relative paths use the script package’s working directory (or esbuild’s `absWorkingDir`); `import.meta.dirname` and `__dirname` refer to the build helper’s folder. Node path calls use the script package’s process directory even when the bundler sets a different working directory. Entry files and their imports count as used without fake imports. Unrelated strings and entries in abandoned build helpers do not establish reachability. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
|
|
409
411
|
|
|
410
412
|
Package `exports` are public API, including wildcard targets and source conditions. Package `bin` and scripts, test and story globs, tool configs and `src/test-support` provide the other entry points. Imports reachable from those entries count as used. Source-conditioned package import aliases resolve to their sources before a build. Compiler mappings from `tsconfig.json` and `tsconfig.build.json` keep imports on their source files when build output exists. An internal module can be used while one of its exports remains unused. An application’s declared dependency entry points satisfy provided imports under the same policy as `imports/manifest`.
|
|
411
413
|
|
|
@@ -422,11 +424,11 @@ For adoption, run `quality baseline write --rule code/unused --file src/legacy.t
|
|
|
422
424
|
- **Hidden casts:** `suppressions/no-double-cast` also checks code outside `adapters/` and `test-support/` for concrete annotations on `JSON.parse` results, unchecked `Reflect.get` bindings, SQL tagged-template row generics, identity overloads whose implementation returns `unknown`, context retagging through `Context.makeUnsafe(...mapUnsafe)`, and writes to readonly properties or native Scope state. Keep untrusted values as `unknown` and decode them with `Schema.decodeUnknownEffect`; decode SQL rows with `SqlSchema` rather than declaring their shape. Give an identity implementation its declared return type, preserve the Context service type, and use native constructors or lifecycle operations instead of changing native fields. Constructor initialization, mutable object writes and extensions that do not replace readonly fields are accepted. These checks read syntax and TypeScript declarations; they do not prove that arbitrary helper functions validate their input.
|
|
423
425
|
- **Suppressions:** the `suppressions/*` rules reject inline lint and compiler directives, casts through `unknown`, `any` or `never`, Biome settings that weaken a check, recommended Biome rules the preset leaves below `error`, and `ignoreDeprecations`. None of them takes exceptions. A type test (`*.typecheck.test.ts`) may use `@ts-expect-error`; a test that must pass a rejected value at run time calls the API through `Reflect.apply`.
|
|
424
426
|
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder (except a module’s client or server `registration.ts` or `registration.tsx` importing its own `<module>/admin/` subtree), production imports of test code, runtime folders and fences, as described above.
|
|
425
|
-
- **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
|
|
427
|
+
- **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 programmatic bundler entries, including main and preload adapters, and tool-discovered config names such as `.dependency-cruiser.ts`. Tool config recognition follows the shared Biome default-export policy, so these configs may also use their required default export. Ordinary modules retain their naming and default-export checks. `files/named-after-export` names a constants module in camelCase for what its exported data shares: `maxItems.ts` exports `MAX_ITEMS`, `timeouts.ts` holds `INSPECT_TIMEOUT_MILLIS` and `REMOTE_TIMEOUT_MILLIS`, `limits.ts` holds constants carrying max, min or limit, and `defaults.ts` holds constants carrying default. Each constant must carry every word of the module name, singular or plural; split unrelated constants or put heterogeneous copy in a single exported record named after itself. Only literal data, arrays and objects of it, and CONSTANT_CASE references count, with types derived from those constants allowed. Schemas, Layers, services, Effects, functions, classes and computed values stay runtime exports. One remaining runtime export names the file even beside constants; two or more use a camelCase topic file. Private constants do not name a file. The same model applies in `src/test-support`. 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.
|
|
426
428
|
- **Change keys:** `boundaries/imported-change-keys` reports literal collection and bucket names in Reactivity invalidations and mutations, SQL `invalidateOnCommit`, and the `changes` key encoders. Import the owning declaration and use its name, list, item or bucket key. Literal record IDs and bucket values are accepted, as are names at their collection declaration.
|
|
427
429
|
- **SQL transactions:** `effect/sql-transact` reports native `sql.withTransaction` calls around repository writes, `transact` or `invalidateOnCommit`. Begin the outer transaction with `transact(effect, { onSqlError })` so changed keys follow its commit. The rule resolves native SQL and repository declarations and follows direct calls, pipes, local aliases and source helpers. Native read-only and raw SQL transactions and unrelated transaction methods remain supported.
|
|
428
430
|
- **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.
|
|
429
|
-
- **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.
|
|
431
|
+
- **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. A package-owned `test/` tree beside its `src/` is an accepted suite: `.test` files follow the corresponding `src/` path, and `.spec` files name behaviours there. This works for workspace members and standalone packages. Outside those trees, `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.
|
|
430
432
|
- **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 `@shivaedev/source` or `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `@shivaedev/source` (or an application’s own `source`), `types` and `default`. Packages with `"private": true` may instead map the wildcard directly to source (`"./*.ts": "./src/*.ts"`); published packages require the full source, types and default conditions. 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. When declared, the standard imports must preserve their roots: `#*.ts` maps directly to `./src/*.ts` or uses `@shivaedev/source` (or an application’s own `source`) `./src/*.ts`, types `./dist/*.d.ts` and default `./dist/*.js`; `#test/*` maps to `./src/test-support/*`. Include subfolders in specifiers, such as `#server/module.ts`. Other aliases are allowed. `manifests/application` keeps an application on its entry points, as described above.
|
|
431
433
|
- **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.
|
|
432
434
|
|
|
@@ -712,4 +714,4 @@ export default defineConfig({
|
|
|
712
714
|
Quality merges the Biome settings at lint and fix time; do not add or mirror an override in `biome.json`. Files are explicit repository paths. Biome exceptions cover individual lint rules or assist actions; whole checks, rule groups and globs are rejected. `biome/files/includes` is the directory exclusion form: keep `**` and list negative patterns naming directories, such as `!**/test-support/generated`. Quality's shipped exceptions are part of its internal policy. [Exceptions and upgrades](https://github.com/ShivaeDev/platform/blob/main/packages/quality/docs/debt-and-hooks.md#exceptions) describes subjects, stale entries and the upgrade command.
|
|
713
715
|
- The source inventory and Biome have their own scopes. `quality fix` runs Biome from the config's folder; it is not restricted to the source-rule inventory.
|
|
714
716
|
- The installed hook checks files on disk, not only what is staged, and uses each committing worktree's config and dependencies. Installation sets repository-local `core.hooksPath`; the hook chains an executable global pre-commit hook without changing global configuration. Either hook's failure blocks the commit. `quality hooks status` reports when git's effective hooks path does not run Quality.
|
|
715
|
-
- Workspace imports require a declaration in the importing package’s `dependencies`, `peerDependencies` or `optionalDependencies`. Tests, `test-support`, package-root tooling folders (`script`, `scripts`, `tooling`) and package-root config files may also use `devDependencies`. Executables and public modules keep their imports in the runtime boundary.
|
|
717
|
+
- Workspace imports require a declaration in the importing package’s `dependencies`, `peerDependencies` or `optionalDependencies`. Tests, `test-support`, package-owned `test/` trees beside `src/`, private test-composition packages, package-root tooling folders (`script`, `scripts`, `tooling`) and package-root config files may also use `devDependencies`. Executables and public modules keep their imports in the runtime boundary.
|
package/biome/declarations.json
CHANGED
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
"rule": "lint/correctness/noUnusedFunctionParameters"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"includes": [
|
|
18
|
+
"includes": [
|
|
19
|
+
"**/*.config.*",
|
|
20
|
+
"**/.dependency-cruiser.{ts,mts,cts,js,mjs,cjs}",
|
|
21
|
+
"**/.railway/railway.ts",
|
|
22
|
+
"**/.railway/railway.py",
|
|
23
|
+
"**/.railway/railway.go"
|
|
24
|
+
],
|
|
19
25
|
"reason": "Tools load their config files through the default export.",
|
|
20
26
|
"rule": "lint/style/noDefaultExport"
|
|
21
27
|
},
|
package/biome/preset.json
CHANGED
|
@@ -635,7 +635,13 @@
|
|
|
635
635
|
"includes": ["**", "!**/package.json"]
|
|
636
636
|
},
|
|
637
637
|
{
|
|
638
|
-
"includes": [
|
|
638
|
+
"includes": [
|
|
639
|
+
"**/*.config.*",
|
|
640
|
+
"**/.dependency-cruiser.{ts,mts,cts,js,mjs,cjs}",
|
|
641
|
+
"**/.railway/railway.ts",
|
|
642
|
+
"**/.railway/railway.py",
|
|
643
|
+
"**/.railway/railway.go"
|
|
644
|
+
],
|
|
639
645
|
"linter": {
|
|
640
646
|
"rules": {
|
|
641
647
|
"style": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asymmetricMatcher.d.ts","sourceRoot":"","sources":["../../src/adapters/asymmetricMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AA6B5B,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAG3F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { importFrom } from "#rules/stories/importOrigin.ts";
|
|
3
|
+
import { unwrapped } from "#rules/stories/syntax.ts";
|
|
4
|
+
const MATCHERS = new Set(["any", "anything", "arrayContaining", "objectContaining", "stringContaining", "stringMatching"]);
|
|
5
|
+
function importedExpect(node, checker) {
|
|
6
|
+
const value = unwrapped(node);
|
|
7
|
+
if (ts.isPropertyAccessExpression(value) && value.name.text === "not") {
|
|
8
|
+
return importedExpect(value.expression, checker);
|
|
9
|
+
}
|
|
10
|
+
const namespace = ts.isPropertyAccessExpression(value) && value.name.text === "expect";
|
|
11
|
+
const receiver = namespace ? value.expression : value;
|
|
12
|
+
if (!ts.isIdentifier(receiver)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return (checker.getSymbolAtLocation(receiver)?.declarations?.some((declaration) => {
|
|
16
|
+
const from = importFrom(declaration);
|
|
17
|
+
return ((from === "vitest" || from === "@effect/vitest")
|
|
18
|
+
&& (namespace
|
|
19
|
+
? ts.isNamespaceImport(declaration)
|
|
20
|
+
: ts.isImportSpecifier(declaration) && (declaration.propertyName ?? declaration.name).text === "expect"));
|
|
21
|
+
}) === true);
|
|
22
|
+
}
|
|
23
|
+
export function asymmetricMatcher(call, checker) {
|
|
24
|
+
const target = unwrapped(call.expression);
|
|
25
|
+
return ts.isPropertyAccessExpression(target) && MATCHERS.has(target.name.text) && importedExpect(target.expression, checker);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=asymmetricMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asymmetricMatcher.js","sourceRoot":"","sources":["../../src/adapters/asymmetricMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE3H,SAAS,cAAc,CAAC,IAAmB,EAAE,OAAuB;IACnE,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACvE,OAAO,cAAc,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,SAAS,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACvF,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IACtD,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CACN,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;QACzE,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QACrC,OAAO,CACN,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,gBAAgB,CAAC;eAC7C,CAAC,SAAS;gBACZ,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC;gBACnC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CACzG,CAAC;IACH,CAAC,CAAC,KAAK,IAAI,CACX,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAuB,EAAE,OAAuB;IACjF,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,OAAO,EAAE,CAAC,0BAA0B,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC9H,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildEntryPaths.d.ts","sourceRoot":"","sources":["../../src/adapters/buildEntryPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AA+B5B,wBAAgB,eAAe,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,WAAW,CAAC,EAAE,CAAC,IAAI,CAAa,GAAG,SAAS,MAAM,EAAE,CAmBjJ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { buildEntryValue, buildOption } from "./buildEntryValue.js";
|
|
4
|
+
import { importedCall } from "./importedCall.js";
|
|
5
|
+
function pathFromCall(node, cwd, paths) {
|
|
6
|
+
if (node.expression.getText() === "process.cwd" && node.arguments.length === 0) {
|
|
7
|
+
return [cwd];
|
|
8
|
+
}
|
|
9
|
+
const imported = importedCall(node);
|
|
10
|
+
if (imported === undefined || !/^(?:node:)?path$/u.test(imported.module) || (imported.name !== "join" && imported.name !== "resolve")) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const parts = node.arguments.map(paths);
|
|
14
|
+
if (parts.some((part) => part.length !== 1)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const values = parts.flat();
|
|
18
|
+
return [imported.name === "resolve" ? posix.resolve(cwd, ...values) : posix.join(...values)];
|
|
19
|
+
}
|
|
20
|
+
function valuesOf(node) {
|
|
21
|
+
if (ts.isArrayLiteralExpression(node)) {
|
|
22
|
+
return node.elements;
|
|
23
|
+
}
|
|
24
|
+
if (!ts.isObjectLiteralExpression(node)) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const input = buildOption(node, "in");
|
|
28
|
+
return input === undefined ? node.properties.flatMap((property) => (ts.isPropertyAssignment(property) ? [property.initializer] : [])) : [input];
|
|
29
|
+
}
|
|
30
|
+
export function buildEntryPaths(expression, cwd, file, active = new Set()) {
|
|
31
|
+
const node = buildEntryValue(expression);
|
|
32
|
+
if (active.has(node)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const visited = new Set([...active, node]);
|
|
36
|
+
function paths(value) {
|
|
37
|
+
return buildEntryPaths(value, cwd, file, visited);
|
|
38
|
+
}
|
|
39
|
+
if (ts.isStringLiteralLike(node)) {
|
|
40
|
+
return [node.text];
|
|
41
|
+
}
|
|
42
|
+
if ((ts.isIdentifier(node) && node.text === "__dirname")
|
|
43
|
+
|| (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.MetaProperty && node.name.text === "dirname")) {
|
|
44
|
+
return [posix.dirname(file)];
|
|
45
|
+
}
|
|
46
|
+
return ts.isCallExpression(node) ? pathFromCall(node, cwd, paths) : valuesOf(node).flatMap(paths);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=buildEntryPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildEntryPaths.js","sourceRoot":"","sources":["../../src/adapters/buildEntryPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,SAAS,YAAY,CAAC,IAAuB,EAAE,GAAW,EAAE,KAAuD;IAClH,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,aAAa,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChF,OAAO,CAAC,GAAG,CAAC,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE,CAAC;QACvI,OAAO,EAAE,CAAC;IACX,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QAC7C,OAAO,EAAE,CAAC;IACX,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,C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,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IACC,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;WACjD,CAAC,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAC9H,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export declare function buildEntryValue(node: ts.Expression, active?: ReadonlySet<ts.Node>): ts.Expression;
|
|
3
|
+
export declare function buildOption(options: ts.ObjectLiteralExpression, name: string): ts.Expression | undefined;
|
|
4
|
+
//# sourceMappingURL=buildEntryValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildEntryValue.d.ts","sourceRoot":"","sources":["../../src/adapters/buildEntryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AA2B5B,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,GAAE,WAAW,CAAC,EAAE,CAAC,IAAI,CAAa,GAAG,EAAE,CAAC,UAAU,CAY5G;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,uBAAuB,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,GAAG,SAAS,CAUxG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
function declaredValue(statements, name) {
|
|
3
|
+
for (const statement of statements) {
|
|
4
|
+
if (!(ts.isVariableStatement(statement) && statement.declarationList.flags & ts.NodeFlags.Const)) {
|
|
5
|
+
continue;
|
|
6
|
+
}
|
|
7
|
+
const declaration = statement.declarationList.declarations.find((entry) => ts.isIdentifier(entry.name) && entry.name.text === name);
|
|
8
|
+
if (declaration !== undefined) {
|
|
9
|
+
return declaration.initializer;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
function initializer(node) {
|
|
15
|
+
let scope = node.parent;
|
|
16
|
+
while (scope !== undefined) {
|
|
17
|
+
const value = ts.isSourceFile(scope) || ts.isBlock(scope) ? declaredValue(scope.statements, node.text) : undefined;
|
|
18
|
+
if (value !== undefined) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
scope = scope.parent;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
export function buildEntryValue(node, active = new Set()) {
|
|
26
|
+
if (active.has(node)) {
|
|
27
|
+
return node;
|
|
28
|
+
}
|
|
29
|
+
const visited = new Set([...active, node]);
|
|
30
|
+
if (ts.isIdentifier(node)) {
|
|
31
|
+
const value = initializer(node);
|
|
32
|
+
return value === undefined ? node : buildEntryValue(value, visited);
|
|
33
|
+
}
|
|
34
|
+
return ts.isAsExpression(node) || ts.isSatisfiesExpression(node) || ts.isParenthesizedExpression(node)
|
|
35
|
+
? buildEntryValue(node.expression, visited)
|
|
36
|
+
: node;
|
|
37
|
+
}
|
|
38
|
+
export function buildOption(options, name) {
|
|
39
|
+
for (const property of options.properties) {
|
|
40
|
+
if ((ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property))
|
|
41
|
+
&& property.name.getText().replace(/^["']|["']$/gu, "") === name) {
|
|
42
|
+
return ts.isPropertyAssignment(property) ? property.initializer : property.name;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=buildEntryValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildEntryValue.js","sourceRoot":"","sources":["../../src/adapters/buildEntryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,aAAa,CAAC,UAAmC,EAAE,IAAY;IACvE,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,eAAe,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YAClG,SAAS;QACV,CAAC;QACD,MAAM,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACpI,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,WAAW,CAAC,WAAW,CAAC;QAChC,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAC,IAAmB;IACvC,IAAI,KAAK,GAAwB,IAAI,CAAC,MAAM,CAAC;IAC7C,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,a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,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,KAAK,IAAI,EAC/D,CAAC;YACF,OAAO,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QACjF,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerEntries.d.ts","sourceRoot":"","sources":["../../src/adapters/bundlerEntries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAiC3C,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAiBnG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { parse } from "#rules/parse.ts";
|
|
4
|
+
import { buildEntryPaths } from "./buildEntryPaths.js";
|
|
5
|
+
import { buildEntryValue, buildOption } from "./buildEntryValue.js";
|
|
6
|
+
import { importedCall } from "./importedCall.js";
|
|
7
|
+
const ESBUILD = new Set(["build", "buildSync", "context"]);
|
|
8
|
+
function entryOption(call) {
|
|
9
|
+
const expression = call.expression;
|
|
10
|
+
if (ts.isPropertyAccessExpression(expression) && expression.expression.getText() === "Bun" && expression.name.text === "build") {
|
|
11
|
+
return "entrypoints";
|
|
12
|
+
}
|
|
13
|
+
const imported = importedCall(call);
|
|
14
|
+
return imported?.module === "esbuild" && ESBUILD.has(imported.name) ? "entryPoints" : undefined;
|
|
15
|
+
}
|
|
16
|
+
function entriesOf(call, file, cwd) {
|
|
17
|
+
const option = entryOption(call);
|
|
18
|
+
const [argument] = call.arguments;
|
|
19
|
+
const options = argument === undefined ? undefined : buildEntryValue(argument);
|
|
20
|
+
if (option === undefined || options === undefined || !ts.isObjectLiteralExpression(options)) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const directory = buildOption(options, "absWorkingDir");
|
|
24
|
+
const working = directory === undefined ? cwd : buildEntryPaths(directory, cwd, file)[0];
|
|
25
|
+
if (working === undefined) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const entries = buildOption(options, option);
|
|
29
|
+
return entries === undefined ? [] : buildEntryPaths(entries, cwd, file).map((path) => posix.resolve(cwd, working, path));
|
|
30
|
+
}
|
|
31
|
+
export function bundlerEntries(file, root, directory) {
|
|
32
|
+
if (!(file.text.includes("esbuild") || file.text.includes("Bun"))) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const source = parse(file);
|
|
36
|
+
if (source === undefined) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
const entries = [];
|
|
40
|
+
function visit(node) {
|
|
41
|
+
if (ts.isCallExpression(node)) {
|
|
42
|
+
entries.push(...entriesOf(node, posix.join(root, file.path), posix.join(root, directory)).map((path) => posix.relative(root, path)));
|
|
43
|
+
}
|
|
44
|
+
ts.forEachChild(node, visit);
|
|
45
|
+
}
|
|
46
|
+
visit(source);
|
|
47
|
+
return entries;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=bundlerEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerEntries.js","sourceRoot":"","sources":["../../src/adapters/bundlerEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB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,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACtI,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,CAAC;IACd,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbackEscapes.d.ts","sourceRoot":"","sources":["../../src/adapters/callbackEscapes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,wBAAgB,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CA6B5G"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function callbackEscapes(checker, call, callback) {
|
|
2
|
+
const seen = new Set();
|
|
3
|
+
function exposed(type) {
|
|
4
|
+
if (seen.has(type) || ["~effect/Effect", "~effect/Stream", "~effect/Layer"].some((brand) => type.getProperty(brand) !== undefined)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
seen.add(type);
|
|
8
|
+
if (type.isUnionOrIntersection()) {
|
|
9
|
+
return type.types.some(exposed);
|
|
10
|
+
}
|
|
11
|
+
if (type
|
|
12
|
+
.getCallSignatures()
|
|
13
|
+
.some((signature) => signature.parameters.some((parameter) => parameter.declarations?.some((declaration) => declaration.parent === callback)))) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return (checker.getIndexInfosOfType(type).some((index) => exposed(index.type))
|
|
17
|
+
|| type
|
|
18
|
+
.getProperties()
|
|
19
|
+
.some((property) => (property.declarations ?? []).some((declaration) => declaration.getSourceFile() === callback.getSourceFile())
|
|
20
|
+
&& exposed(checker.getTypeOfSymbol(property))));
|
|
21
|
+
}
|
|
22
|
+
return exposed(checker.getTypeAtLocation(call));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=callbackEscapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbackEscapes.js","sourceRoot":"","sources":["../../src/adapters/callbackEscapes.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,OAAuB,EAAE,IAAuB,EAAE,QAAiB;IAClG,MAAM,IAAI,GAAG,IAAI,GAAG,EAAW,CAAC;IAChC,SAAS,OAAO,CAAC,IAAa;QAC7B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,EAAE,CAAC;YACpI,OAAO,KAAK,CAAC;QACd,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,IACC,IAAI;aACF,iBAAiB,EAAE;aACnB,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAC9I,CAAC;YACF,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CACN,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;eACnE,IAAI;iBACL,aAAa,EAAE;iBACf,IAAI,CACJ,CAAC,QAAQ,EAAE,EAAE,CACZ,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,aAAa,EAAE,KAAK,QAAQ,CAAC,aAAa,EAAE,CAAC;mBAC1G,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAC9C,CACF,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composedContext.d.ts","sourceRoot":"","sources":["../../src/adapters/composedContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAmB5B,wBAAgB,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,EAAE,CAAC,UAAU,GAAG,OAAO,CA4B5F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { effectApi, resolvedValue } from "#adapters/serviceModelSyntax.ts";
|
|
3
|
+
import { boundaryReference } from "#rules/effect/boundaryReference.ts";
|
|
4
|
+
function closedEffect(checker, node) {
|
|
5
|
+
const brand = checker.getTypeAtLocation(node).getProperty("~effect/Effect");
|
|
6
|
+
const requirement = brand === undefined ? undefined : checker.getTypeOfSymbol(brand).getProperty("_R");
|
|
7
|
+
const type = requirement === undefined ? undefined : checker.getTypeOfSymbol(requirement).getCallSignatures()[0]?.getReturnType();
|
|
8
|
+
return type !== undefined && (type.flags & ts.TypeFlags.Never) !== 0;
|
|
9
|
+
}
|
|
10
|
+
function layerProvision(checker, node) {
|
|
11
|
+
return (ts.isCallExpression(node)
|
|
12
|
+
&& effectApi(checker, node.expression, "provide")
|
|
13
|
+
&& node.arguments.some((argument) => checker.getTypeAtLocation(argument).getProperty("~effect/Layer") !== undefined));
|
|
14
|
+
}
|
|
15
|
+
export function composedContext(checker, environment) {
|
|
16
|
+
const value = resolvedValue(checker, environment);
|
|
17
|
+
if (!(ts.isYieldExpression(value) && value.expression !== undefined && ts.isCallExpression(value.expression))) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const acquisition = value.expression;
|
|
21
|
+
const reference = boundaryReference(checker, acquisition.expression);
|
|
22
|
+
if (reference === "effect.Layer.build"
|
|
23
|
+
|| reference === "effect/Layer.build"
|
|
24
|
+
|| reference === "effect.Layer.buildWithScope"
|
|
25
|
+
|| reference === "effect/Layer.buildWithScope") {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (!effectApi(checker, acquisition.expression, "context")) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
let provided = false;
|
|
32
|
+
for (let ancestor = value.parent; ancestor !== undefined; ancestor = ancestor.parent) {
|
|
33
|
+
if (ts.isCallExpression(ancestor)) {
|
|
34
|
+
provided ||= layerProvision(checker, ancestor) || ancestor.arguments.some((argument) => layerProvision(checker, argument));
|
|
35
|
+
if (provided && closedEffect(checker, ancestor)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=composedContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composedContext.js","sourceRoot":"","sources":["../../src/adapters/composedContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,SAAS,YAAY,CAAC,OAAuB,EAAE,IAAa;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,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,MAAM,SAAS,GAAG,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACrE,IACC,SAAS,KAAK,oBAAoB;WAC/B,SAAS,KAAK,oBAAoB;WAClC,SAAS,KAAK,6BAA6B;WAC3C,SAAS,KAAK,6BAA6B,EAC7C,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACd,CAAC;IACD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,KAAK,IAAI,QAAQ,GAAwB,KAAK,CAAC,MAAM,EAAE,QAAQ,KAAK,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC3G,IAAI,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,QAAQ,KAAK,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC3H,IAAI,QAAQ,IAAI,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { serviceTypes } from "#rules/effect/serviceTypes.ts";
|
|
3
|
+
export declare function containerDependency(checker: ts.TypeChecker, type: ts.Type, services: ReturnType<typeof serviceTypes>, seen?: Set<ts.Type>): boolean;
|
|
4
|
+
//# sourceMappingURL=containerDependency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerDependency.d.ts","sourceRoot":"","sources":["../../src/adapters/containerDependency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAkBlE,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,QAAQ,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EACzC,IAAI,eAAqB,GACvB,OAAO,CAeT"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
const NATIVE = /\/effect\/(?:src|dist(?:\/dts)?)\/(?:Ref|SynchronizedRef|ScopedRef|Cache|ScopedCache|Deferred|Queue|PubSub|HashMap|HashSet)\.(?:d\.)?ts$/u;
|
|
3
|
+
const COLLECTIONS = new Set(["Map", "ReadonlyMap", "Set", "ReadonlySet", "Array", "ReadonlyArray"]);
|
|
4
|
+
function reference(type) {
|
|
5
|
+
return "objectFlags" in type && typeof type.objectFlags === "number" && (type.objectFlags & ts.ObjectFlags.Reference) !== 0;
|
|
6
|
+
}
|
|
7
|
+
function container(type) {
|
|
8
|
+
const symbol = type.getSymbol();
|
|
9
|
+
return (symbol?.declarations ?? []).some((declaration) => {
|
|
10
|
+
const file = declaration.getSourceFile().fileName.replaceAll("\\", "/");
|
|
11
|
+
return NATIVE.test(file) || (COLLECTIONS.has(symbol?.name ?? "") && /\/lib\.[^/]+\.d\.ts$/u.test(file));
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function containerDependency(checker, type, services, seen = new Set()) {
|
|
15
|
+
if (seen.has(type) || !(type.flags & (ts.TypeFlags.Object | ts.TypeFlags.Union | ts.TypeFlags.Intersection)) || services.computation(type)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
seen.add(type);
|
|
19
|
+
if (type.isUnionOrIntersection()) {
|
|
20
|
+
return type.types.some((part) => containerDependency(checker, part, services, seen));
|
|
21
|
+
}
|
|
22
|
+
if (container(type) && reference(type)) {
|
|
23
|
+
return checker.getTypeArguments(type).some((argument) => services.carries(argument) || containerDependency(checker, argument, services, seen));
|
|
24
|
+
}
|
|
25
|
+
return (type.getCallSignatures().length === 0
|
|
26
|
+
&& type.getProperties().some((property) => containerDependency(checker, checker.getTypeOfSymbol(property), services, seen)));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=containerDependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerDependency.js","sourceRoot":"","sources":["../../src/adapters/containerDependency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,MAAM,MAAM,GACX,2IAA2I,CAAC;AAC7I,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;AAEpG,SAAS,SAAS,CAAC,IAAa;IAC/B,OAAO,aAAa,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC7H,CAAC;AAED,SAAS,SAAS,CAAC,IAAa;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,OAAO,CAAC,MAAM,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;QACxD,MAAM,IAAI,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC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AO,EAAE,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAC3H,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextCaptureFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/contextCaptureFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"contextCaptureFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/contextCaptureFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAqBpD,eAAO,MAAM,sBAAsB,gEAiClC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
+
import { composedContext } from "#adapters/composedContext.ts";
|
|
4
5
|
import { effectApi } from "#adapters/serviceModelSyntax.ts";
|
|
5
6
|
import { effectProgram } from "#rules/effect/program.ts";
|
|
6
7
|
const RUNNERS = ["provideContext", "runPromiseWith", "runForkWith"];
|
|
@@ -33,7 +34,8 @@ export const contextCaptureFindings = Effect.fn("ContextCapture.contextCaptureFi
|
|
|
33
34
|
const syntax = source;
|
|
34
35
|
const findings = [];
|
|
35
36
|
function visit(node) {
|
|
36
|
-
|
|
37
|
+
const environment = ts.isCallExpression(node) ? node.arguments.at(-1) : undefined;
|
|
38
|
+
if (ts.isCallExpression(node) && reprovides(checker, node) && !(environment !== undefined && composedContext(checker, environment))) {
|
|
37
39
|
findings.push({
|
|
38
40
|
file: file.path,
|
|
39
41
|
line: syntax.getLineAndCharacterOfPosition(node.getStart(syntax)).line + 1,
|