@shivaedev/quality 0.74.0 → 0.74.2
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 +16 -0
- package/README.md +4 -4
- package/dist/adapters/buildEntryValue.d.ts +1 -0
- package/dist/adapters/buildEntryValue.d.ts.map +1 -1
- package/dist/adapters/buildEntryValue.js +1 -1
- package/dist/adapters/buildEntryValue.js.map +1 -1
- package/dist/adapters/buildHelper.d.ts +1 -0
- package/dist/adapters/buildHelper.d.ts.map +1 -1
- package/dist/adapters/buildHelper.js +9 -8
- package/dist/adapters/buildHelper.js.map +1 -1
- package/dist/adapters/bundlerExternals.d.ts +4 -0
- package/dist/adapters/bundlerExternals.d.ts.map +1 -0
- package/dist/adapters/bundlerExternals.js +46 -0
- package/dist/adapters/bundlerExternals.js.map +1 -0
- package/dist/adapters/bundlerSources.d.ts +1 -0
- package/dist/adapters/bundlerSources.d.ts.map +1 -1
- package/dist/adapters/bundlerSources.js +17 -4
- package/dist/adapters/bundlerSources.js.map +1 -1
- package/dist/adapters/bundlerTargets.d.ts +8 -0
- package/dist/adapters/bundlerTargets.d.ts.map +1 -0
- package/dist/adapters/{bundlerEntries.js → bundlerTargets.js} +18 -15
- package/dist/adapters/bundlerTargets.js.map +1 -0
- package/dist/adapters/importedCall.d.ts +4 -0
- package/dist/adapters/importedCall.d.ts.map +1 -1
- package/dist/adapters/importedCall.js +6 -3
- package/dist/adapters/importedCall.js.map +1 -1
- package/dist/adapters/imports/departures.d.ts.map +1 -1
- package/dist/adapters/imports/departures.js +7 -1
- package/dist/adapters/imports/departures.js.map +1 -1
- package/dist/adapters/isToolConfig.d.ts.map +1 -1
- package/dist/adapters/isToolConfig.js +5 -1
- package/dist/adapters/isToolConfig.js.map +1 -1
- package/dist/adapters/knip/configuration.d.ts +3 -1
- package/dist/adapters/knip/configuration.d.ts.map +1 -1
- package/dist/adapters/knip/configuration.js +8 -2
- package/dist/adapters/knip/configuration.js.map +1 -1
- package/dist/adapters/knip/run.js +3 -3
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/outsideImportFindings.d.ts.map +1 -1
- package/dist/adapters/outsideImportFindings.js +18 -15
- package/dist/adapters/outsideImportFindings.js.map +1 -1
- package/dist/adapters/reachableBuilds.d.ts +9 -0
- package/dist/adapters/reachableBuilds.d.ts.map +1 -0
- package/dist/adapters/{reachableBuildEntries.js → reachableBuilds.js} +15 -11
- package/dist/adapters/reachableBuilds.js.map +1 -0
- package/dist/imports/isTooling.d.ts +1 -0
- package/dist/imports/isTooling.d.ts.map +1 -1
- package/dist/imports/isTooling.js +6 -3
- package/dist/imports/isTooling.js.map +1 -1
- package/dist/inventory/programmaticBuilds.d.ts +4 -0
- package/dist/inventory/programmaticBuilds.d.ts.map +1 -0
- package/dist/inventory/programmaticBuilds.js +13 -0
- package/dist/inventory/programmaticBuilds.js.map +1 -0
- package/dist/rules/effect/adapterImports.js +1 -1
- package/dist/rules/effect/adapterImports.js.map +1 -1
- package/dist/rules/effect/boundary.d.ts.map +1 -1
- package/dist/rules/effect/boundary.js +9 -7
- package/dist/rules/effect/boundary.js.map +1 -1
- package/dist/rules/effect/boundaryReference.d.ts +3 -0
- package/dist/rules/effect/boundaryReference.d.ts.map +1 -1
- package/dist/rules/effect/boundaryReference.js +23 -2
- package/dist/rules/effect/boundaryReference.js.map +1 -1
- package/dist/rules/files/namedAfterExport.js +2 -2
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/imports/aliased.js +1 -1
- package/dist/rules/imports/aliased.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/buildEntryValue.ts +1 -1
- package/src/adapters/buildHelper.ts +10 -9
- package/src/adapters/bundlerExternals.ts +57 -0
- package/src/adapters/bundlerSources.ts +23 -4
- package/src/adapters/{bundlerEntries.ts → bundlerTargets.ts} +39 -15
- package/src/adapters/importedCall.ts +7 -3
- package/src/adapters/imports/departures.ts +7 -1
- package/src/adapters/isToolConfig.ts +7 -3
- package/src/adapters/knip/configuration.ts +13 -2
- package/src/adapters/knip/run.ts +3 -3
- package/src/adapters/outsideImportFindings.ts +18 -15
- package/src/adapters/{reachableBuildEntries.ts → reachableBuilds.ts} +19 -10
- package/src/imports/isTooling.ts +7 -3
- package/src/inventory/{programmaticEntries.ts → programmaticBuilds.ts} +5 -3
- package/src/rules/effect/adapterImports.ts +1 -1
- package/src/rules/effect/boundary.ts +25 -17
- package/src/rules/effect/boundaryReference.ts +30 -2
- package/src/rules/files/namedAfterExport.ts +2 -2
- package/src/rules/imports/aliased.ts +1 -1
- package/dist/adapters/bundlerEntries.d.ts +0 -4
- package/dist/adapters/bundlerEntries.d.ts.map +0 -1
- package/dist/adapters/bundlerEntries.js.map +0 -1
- package/dist/adapters/reachableBuildEntries.d.ts +0 -5
- package/dist/adapters/reachableBuildEntries.d.ts.map +0 -1
- package/dist/adapters/reachableBuildEntries.js.map +0 -1
- package/dist/inventory/programmaticEntries.d.ts +0 -4
- package/dist/inventory/programmaticEntries.d.ts.map +0 -1
- package/dist/inventory/programmaticEntries.js +0 -11
- package/dist/inventory/programmaticEntries.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.74.2 - 2026-11-08
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `effect/adapter-imports` and `effect/boundary` accept a tool config directly in a package's folder, such as `vitest.config.ts`, because the tool loads it from that fixed path; configs deeper in the package stay checked.
|
|
8
|
+
- `effect/adapter-imports` accepts `node:process` in entry modules (cli, main and entry files, `runMain` callers and the `import.meta.url` argv guard), so it no longer contradicts Biome's `noProcessGlobal`; other builtins there, and `node:process` elsewhere, stay reported.
|
|
9
|
+
- `effect/adapter-imports` accepts Vitest imports in every test and spec, also in packages that list Vitest as a peer; Vitest in shipped source stays reported.
|
|
10
|
+
- `code/unused` and `files/named-after-export` treat `.railway/postgres-schedules.ts`, which `@shivaedev/deploy` loads from its default path, as an entry that keeps its name.
|
|
11
|
+
- `imports/aliased` accepts relative imports between tool configs directly in a package's folder, which no `#` alias reaches.
|
|
12
|
+
|
|
13
|
+
## 0.74.1 - 2026-11-08
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- `code/unused`: Count declared dependencies named in a Rolldown, esbuild or Bun `external` list as used by the package whose build script bundles them, including lists imported from another module and narrowed with `.filter`. Dependencies that nothing imports or names as external are still reported.
|
|
18
|
+
|
|
3
19
|
## 0.74.0 - 2026-11-07
|
|
4
20
|
|
|
5
21
|
### Added
|
package/README.md
CHANGED
|
@@ -130,7 +130,7 @@ It also reports synchronous calls imported from `node:fs` and `node:child_proces
|
|
|
130
130
|
|
|
131
131
|
`Effect.run*` references in core are reported even without Clock, Config or Random. Yield the computation so it uses the caller's runtime. Runners are accepted in `cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, tool configs and tests, modules that call `runMain`, and modules with the `fileURLToPath(import.meta.url) === process.argv[1]` entry guard. Browser bootstraps use the `main` or `entry` filename convention; the starter uses `examples/starter/src/client/main.tsx`. These entry-point conventions accept runners only; the other boundary checks still apply.
|
|
132
132
|
|
|
133
|
-
Within Effect code, folders named `adapters/` or `test-support/`, at any depth, are exempt from this boundary rule. An `adapters/` folder bridges an outside library and hands the rest of the application Effect values. The name is fixed by convention, with no config or copied Biome plugin globs. Adapter code still follows `effect/service-parameters` and the ambient time, randomness, console and environment bans.
|
|
133
|
+
Within Effect code, folders named `adapters/` or `test-support/`, at any depth, are exempt from this boundary rule, and so is a tool config directly in a package's folder (`*.config.ts` beside its `package.json`, such as `vitest.config.ts`), because the tool loads it from that fixed path. A config deeper in the package, such as `src/domEnvironment.config.ts`, is checked. An `adapters/` folder bridges an outside library and hands the rest of the application Effect values. The name is fixed by convention, with no config or copied Biome plugin globs. Adapter code still follows `effect/service-parameters` and the ambient time, randomness, console and environment bans.
|
|
134
134
|
|
|
135
135
|
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.
|
|
136
136
|
|
|
@@ -160,7 +160,7 @@ The rule reports hidden configurations and method records, configuration and ope
|
|
|
160
160
|
|
|
161
161
|
`effect/adapter-imports` reports value imports of non-Effect dependencies, peers and optional dependencies, and Node builtins, at the import site. It includes side-effect imports, value re-exports, literal dynamic imports and `require` calls. Each package is checked against its own manifest; dev-only tools and workspace modules are accepted. Type-only imports and re-exports are accepted, including inline `type` specifiers when every binding is a type.
|
|
162
162
|
|
|
163
|
-
Move the integration into an `adapters/` folder and expose Effect values to the rest of the application. Use `import type` when only a type is needed. Folders named `adapters/` and `test-support/`, Effect packages (`effect` and `@effect/*`, including `@effect/platform-node`), native `@shivaedev/*` framework packages,
|
|
163
|
+
Move the integration into an `adapters/` folder and expose Effect values to the rest of the application. Use `import type` when only a type is needed. Folders named `adapters/` and `test-support/`, tool configs directly in a package's folder (such as `vitest.config.ts`, which the tool loads from that fixed path), Effect packages (`effect` and `@effect/*`, including `@effect/platform-node`), native `@shivaedev/*` framework packages, Vitest imports in every test and spec, and rendering libraries in `client/` folders are accepted. The client rendering libraries are `react`, `react-dom`, `recharts`, `lucide-react`, `@base-ui/react`, `@tanstack/react-router`, `@tanstack/react-table`, `class-variance-authority`, `cn`, `clsx` and `tailwind-merge`, including their subpath imports. Import UI components, routing and styling helpers directly in client code. Recharts is the stack's charting library; build charts with shadcn's Chart component (`ChartContainer` and friends) rather than raw recharts primitives where shadcn covers the case. Libraries that perform I/O or manage external state, such as `axios`, `better-auth/react`, `@tanstack/react-query` and `zustand`, still need adapters there. Other outside libraries and non-client rendering imports still need adapters. Entry modules (`cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, modules that call `runMain` and modules with the `fileURLToPath(import.meta.url) === process.argv[1]` guard) may import `node:process` to read arguments and the working directory; their other imports, and `node:process` in any other module, test or config, still need adapters. Vitest in shipped source and configs deeper in a package are still reported.
|
|
164
164
|
|
|
165
165
|
The rule refuses config exceptions and inline suppressions. For existing debt, run `quality baseline write --rule effect/adapter-imports`; baseline shards keep one entry per file with its finding count. Run `quality baseline tighten` after moving integrations.
|
|
166
166
|
|
|
@@ -436,7 +436,7 @@ Git calls `quality baseline merge <ancestor> <current> <other>`. Entries are key
|
|
|
436
436
|
|
|
437
437
|
### Unused code
|
|
438
438
|
|
|
439
|
-
`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, Rolldown `build` and `watch` calls (including config arrays), and `Bun.build`, reading literal entry lists or maps, local constants, array spreads, arguments passed through local or imported build helpers, mapped config array elements, builds inside Effect acquisition callbacks, and Node path `join`, `resolve` and `dirname` calls, including `fileURLToPath(import.meta.url)`. Conventional tool configs, including dependency-cruiser configs and nested Vitest configs, are entries too. 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. Node module resolution through `createRequire(...).resolve(...)` also counts as dependency use; an ordinary object’s `resolve` method does not. 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.
|
|
439
|
+
`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, Rolldown `build` and `watch` calls (including config arrays), and `Bun.build`, reading literal entry lists or maps, local constants, array spreads, arguments passed through local or imported build helpers, mapped config array elements, builds inside Effect acquisition callbacks, and Node path `join`, `resolve` and `dirname` calls, including `fileURLToPath(import.meta.url)`. Conventional tool configs, including dependency-cruiser configs and nested Vitest configs, are entries too, and so is `.railway/postgres-schedules.ts`, which `@shivaedev/deploy` loads from its default path; `files/named-after-export` lets it keep that name. Other modules in `.railway/` are checked as usual. 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. Package names in a traced build's `external` option, including a list imported from another module or narrowed with `.filter`, count as use of the bundling package's declared dependencies, because the bundle imports them at runtime. Node module resolution through `createRequire(...).resolve(...)` also counts as dependency use; an ordinary object’s `resolve` method does not. 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.
|
|
440
440
|
|
|
441
441
|
Declare files reached only through runtime-built paths with repository-relative `entries` paths or globs. Quality passes these entries to knip, so the files and their imports count as used. A path or glob that matches no file fails the run and names the unmatched pattern. This covers spawned scripts and roots chosen at runtime:
|
|
442
442
|
|
|
@@ -460,7 +460,7 @@ For adoption, run `quality baseline write --rule code/unused` and review the rec
|
|
|
460
460
|
- **Documentation:** `docs/references` checks every Markdown file in the sources except `CHANGELOG.md`, whose released history keeps the links of its release. Relative links, reference definitions and `href`/`src` attributes reach an existing file or folder inside the repository, and a heading anchor matches one GitHub forms from the target's headings. A link to the repository's own GitHub tree, named by the root `package.json` `repository` field, is checked like a relative one unless it is pinned to a commit or a release tag. A published workspace package's README is shown on npm without the repository around it, so its links that leave the package use absolute URLs. Imports in TypeScript and JavaScript code blocks, workspace module paths such as `@scope/lib/repository.ts` written as inline code, `` `name` from `module` `` phrases and a package README's API rows resolve through the owning package's `exports` to an exported module, and every named import exists in that module unless it re-exports another. A linked document such as `CLAUDE.md` beside `AGENTS.md` is checked once, through its target. `docs/unversioned-installs` rejects a version after a package name in install commands, in shell code blocks and inline code; the package's own version ranges decide what installs, and a written version goes stale with the next release. A dist-tag such as `latest` passes.
|
|
461
461
|
- **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.
|
|
462
462
|
- **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`.
|
|
463
|
-
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports of own modules (including same-folder files and registration subtrees; use the package’s `#` aliases), production imports of test code, runtime folders and fences, as described above.
|
|
463
|
+
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports of own modules (including same-folder files and registration subtrees; use the package’s `#` aliases, except between tool configs directly in a package's folder, such as `vitest.coverage.config.ts` importing `./vitest.config.ts`, which no alias reaches), production imports of test code, runtime folders and fences, as described above.
|
|
464
464
|
- **Names and files:** `files/folder-names` accepts an unscoped package name matching any trailing run of its folder path joined with hyphens, with singular or plural segments. For example, `packages/server/domains/agents` accepts `domain-agents` or `agents`, and `apps/testing` accepts `app-testing`; unrelated or stale package names still fail. The Biome preset's naming rules and plugins, together with the remaining `files/*` rules, name a file after its main export with its folders as the prefix. Root authority documents such as `DESIGN.md`, `ARCHITECTURE.md` and `GLOSSARY.md` are accepted beside `AGENTS.md`. `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. The Quality gate also accepts Vitest configs and reporters named by explicit `--config` or `--reporter` paths in package scripts, and adapter plugins whose default export implements an imported foreign Plugin type. 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: `options.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.
|
|
465
465
|
- **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.
|
|
466
466
|
- **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.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
export type BuildBindings = ReadonlyMap<ts.ParameterDeclaration, ts.Expression>;
|
|
3
|
+
export declare function declaredValue(statements: readonly ts.Statement[], name: string): ts.Expression | undefined;
|
|
3
4
|
export declare function buildEntryValue(node: ts.Expression, active?: ReadonlySet<ts.Node>, bindings?: BuildBindings): ts.Expression;
|
|
4
5
|
export declare function buildOption(options: ts.ObjectLiteralExpression, name: string): ts.Expression | undefined;
|
|
5
6
|
//# sourceMappingURL=buildEntryValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildEntryValue.d.ts","sourceRoot":"","sources":["../../src/adapters/buildEntryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,EAAE,CAAC,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"buildEntryValue.d.ts","sourceRoot":"","sources":["../../src/adapters/buildEntryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,EAAE,CAAC,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;AAEhF,wBAAgB,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,GAAG,SAAS,CAW1G;AAoBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,GAAE,WAAW,CAAC,EAAE,CAAC,IAAI,CAAa,EAAE,QAAQ,GAAE,aAAyB,GAAG,EAAE,CAAC,UAAU,CAYjJ;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,uBAAuB,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,GAAG,SAAS,CAUxG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
function declaredValue(statements, name) {
|
|
2
|
+
export function declaredValue(statements, name) {
|
|
3
3
|
for (const statement of statements) {
|
|
4
4
|
if (!(ts.isVariableStatement(statement) && statement.declarationList.flags & ts.NodeFlags.Const)) {
|
|
5
5
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildEntryValue.js","sourceRoot":"","sources":["../../src/adapters/buildEntryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,
|
|
1
|
+
{"version":3,"file":"buildEntryValue.js","sourceRoot":"","sources":["../../src/adapters/buildEntryValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,MAAM,UAAU,aAAa,CAAC,UAAmC,EAAE,IAAY;IAC9E,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,EAAE,QAAuB;IAChE,IAAI,KAAK,GAAwB,IAAI,CAAC,MAAM,CAAC;IAC7C,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5B,IAAI,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAA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BAAyB,CAAC,IAAI,CAAC;QACrG,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC;QACrD,CAAC,CAAC,IAAI,CAAC;AACT,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAmC,EAAE,IAAY;IAC5E,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3C,IACC,CAAC,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;eAC9E,QAAQ,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"}
|
|
@@ -2,6 +2,7 @@ import ts from "typescript";
|
|
|
2
2
|
import { type BuildBindings } from "#adapters/buildEntryValue.ts";
|
|
3
3
|
type Helper = ts.FunctionDeclaration | ts.FunctionExpression | ts.ArrowFunction;
|
|
4
4
|
export declare function buildArguments(helper: Helper, call: ts.CallExpression, bindings: BuildBindings): BuildBindings;
|
|
5
|
+
export declare function importedSource(node: ts.Node, module: string, sources: ReadonlyMap<string, ts.SourceFile>): ts.SourceFile | undefined;
|
|
5
6
|
export declare function buildHelper(call: ts.CallExpression, sources: ReadonlyMap<string, ts.SourceFile>, bindings: BuildBindings): Helper | undefined;
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=buildHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHelper.d.ts","sourceRoot":"","sources":["../../src/adapters/buildHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,8BAA8B,CAAC;AAGnF,KAAK,MAAM,GAAG,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,kBAAkB,GAAG,EAAE,CAAC,aAAa,CAAC;AAEhF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,GAAG,aAAa,CAS9G;
|
|
1
|
+
{"version":3,"file":"buildHelper.d.ts","sourceRoot":"","sources":["../../src/adapters/buildHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,8BAA8B,CAAC;AAGnF,KAAK,MAAM,GAAG,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,kBAAkB,GAAG,EAAE,CAAC,aAAa,CAAC;AAEhF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,aAAa,GAAG,aAAa,CAS9G;AAqCD,wBAAgB,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,GAAG,SAAS,CAMpI;AAQD,wBAAgB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAM7I"}
|
|
@@ -43,16 +43,17 @@ function localHelper(expression, call) {
|
|
|
43
43
|
}
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
if (imported === undefined || !(imported.module.startsWith(".") || imported.module.startsWith("#"))) {
|
|
46
|
+
export function importedSource(node, module, sources) {
|
|
47
|
+
if (!(module.startsWith(".") || module.startsWith("#"))) {
|
|
49
48
|
return undefined;
|
|
50
49
|
}
|
|
51
|
-
const modulePath =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const modulePath = module.startsWith("#") ? module.slice(1) : posix.join(posix.dirname(node.getSourceFile().fileName), module);
|
|
51
|
+
return sources.get(modulePath) ?? [...sources.values()].find((candidate) => candidate.fileName.replaceAll("\\", "/").endsWith(`/${modulePath}`));
|
|
52
|
+
}
|
|
53
|
+
function importedHelper(call, sources) {
|
|
54
|
+
const imported = importedCall(call);
|
|
55
|
+
const source = imported === undefined ? undefined : importedSource(call, imported.module, sources);
|
|
56
|
+
return source === undefined || imported === undefined ? undefined : declared(source, imported.name);
|
|
56
57
|
}
|
|
57
58
|
export function buildHelper(call, sources, bindings) {
|
|
58
59
|
const expression = buildEntryValue(call.expression, new Set(), bindings);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHelper.js","sourceRoot":"","sources":["../../src/adapters/buildHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAsB,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,IAAuB,EAAE,QAAuB;IAC9F,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,KAAK,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC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,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrG,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAuB,EAAE,OAA2C,EAAE,QAAuB;IACxH,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzE,IAAI,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3E,OAAO,UAAU,CAAC;IACnB,CAAC;IACD,OAAO,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { type BuildBindings } from "#adapters/buildEntryValue.ts";
|
|
3
|
+
export declare function bundlerExternals(options: ts.ObjectLiteralExpression, bindings: BuildBindings, sources: ReadonlyMap<string, ts.SourceFile>): readonly string[];
|
|
4
|
+
//# sourceMappingURL=bundlerExternals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerExternals.d.ts","sourceRoot":"","sources":["../../src/adapters/bundlerExternals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAA+C,MAAM,8BAA8B,CAAC;AA4C/G,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,EAAE,CAAC,uBAAuB,EACnC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GACzC,SAAS,MAAM,EAAE,CAOnB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { buildEntryValue, buildOption, declaredValue } from "#adapters/buildEntryValue.ts";
|
|
3
|
+
import { importedSource } from "#adapters/buildHelper.ts";
|
|
4
|
+
import { importedName } from "#adapters/importedCall.ts";
|
|
5
|
+
import { packageNameOf } from "#imports/packageName.ts";
|
|
6
|
+
function importedValue(node, sources) {
|
|
7
|
+
const imported = importedName(node);
|
|
8
|
+
const source = imported === undefined ? undefined : importedSource(node, imported.module, sources);
|
|
9
|
+
return source === undefined || imported === undefined ? undefined : declaredValue(source.statements, imported.name);
|
|
10
|
+
}
|
|
11
|
+
function externalNames(expression, bindings, sources, active) {
|
|
12
|
+
const node = buildEntryValue(expression, new Set(), bindings);
|
|
13
|
+
if (active.has(node)) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const visited = new Set([...active, node]);
|
|
17
|
+
function names(value) {
|
|
18
|
+
return externalNames(value, bindings, sources, visited);
|
|
19
|
+
}
|
|
20
|
+
if (ts.isStringLiteralLike(node)) {
|
|
21
|
+
return [node.text];
|
|
22
|
+
}
|
|
23
|
+
if (ts.isSpreadElement(node)) {
|
|
24
|
+
return names(node.expression);
|
|
25
|
+
}
|
|
26
|
+
if (ts.isArrayLiteralExpression(node)) {
|
|
27
|
+
return node.elements.flatMap(names);
|
|
28
|
+
}
|
|
29
|
+
if (ts.isIdentifier(node)) {
|
|
30
|
+
const value = importedValue(node, sources);
|
|
31
|
+
return value === undefined ? [] : names(value);
|
|
32
|
+
}
|
|
33
|
+
// A filter keeps only names the list already declares external, so the whole list stands in for its predicate.
|
|
34
|
+
return ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === "filter"
|
|
35
|
+
? names(node.expression.expression)
|
|
36
|
+
: [];
|
|
37
|
+
}
|
|
38
|
+
export function bundlerExternals(options, bindings, sources) {
|
|
39
|
+
const external = buildOption(options, "external");
|
|
40
|
+
return external === undefined
|
|
41
|
+
? []
|
|
42
|
+
: externalNames(external, bindings, sources, new Set())
|
|
43
|
+
.filter((name) => !(name.startsWith(".") || name.startsWith("/")))
|
|
44
|
+
.map(packageNameOf);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=bundlerExternals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerExternals.js","sourceRoot":"","sources":["../../src/adapters/bundlerExternals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAsB,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,SAAS,aAAa,CAAC,IAAmB,EAAE,OAA2C;IACtF,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnG,OAAO,MAAM,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrH,CAAC;AAED,SAAS,aAAa,CACrB,UAAyB,EACzB,QAAuB,EACvB,OAA2C,EAC3C,MAA4B;IAE5B,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9D,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3C,SAAS,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AAC,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,CAAC;aACpD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;aACjE,GAAG,CAAC,aAAa,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -2,4 +2,5 @@ import ts from "typescript";
|
|
|
2
2
|
import type { ImportGraph } from "#imports/graph.ts";
|
|
3
3
|
import type { SourceFile } from "#rule.ts";
|
|
4
4
|
export declare function bundlerSources(files: readonly SourceFile[], graph: ImportGraph): ReadonlyMap<string, ts.SourceFile>;
|
|
5
|
+
export declare function bundlerModules(sources: ReadonlyMap<string, ts.SourceFile>, files: readonly SourceFile[], graph: ImportGraph): ReadonlyMap<string, ts.SourceFile>;
|
|
5
6
|
//# sourceMappingURL=bundlerSources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundlerSources.d.ts","sourceRoot":"","sources":["../../src/adapters/bundlerSources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"bundlerSources.d.ts","sourceRoot":"","sources":["../../src/adapters/bundlerSources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA0C3C,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,CAiBnH;AAED,wBAAgB,cAAc,CAC7B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAC3C,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,KAAK,EAAE,WAAW,GAChB,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,CAWpC"}
|
|
@@ -25,12 +25,13 @@ function directSources(files) {
|
|
|
25
25
|
}
|
|
26
26
|
return sources;
|
|
27
27
|
}
|
|
28
|
+
function fileEdges(graph) {
|
|
29
|
+
return graph.edges.flatMap((edge) => (!edge.type && edge.to.kind === "file" ? [[edge.from, edge.to.path]] : []));
|
|
30
|
+
}
|
|
28
31
|
function importedBy(graph) {
|
|
29
32
|
const importers = new Map();
|
|
30
|
-
for (const
|
|
31
|
-
|
|
32
|
-
importers.set(edge.to.path, [...(importers.get(edge.to.path) ?? []), edge.from]);
|
|
33
|
-
}
|
|
33
|
+
for (const [from, to] of fileEdges(graph)) {
|
|
34
|
+
importers.set(to, [...(importers.get(to) ?? []), from]);
|
|
34
35
|
}
|
|
35
36
|
return importers;
|
|
36
37
|
}
|
|
@@ -52,4 +53,16 @@ export function bundlerSources(files, graph) {
|
|
|
52
53
|
}
|
|
53
54
|
return sources;
|
|
54
55
|
}
|
|
56
|
+
export function bundlerModules(sources, files, graph) {
|
|
57
|
+
const filesByPath = new Map(files.map((file) => [file.path, file]));
|
|
58
|
+
const modules = new Map(sources);
|
|
59
|
+
for (const [from, to] of fileEdges(graph)) {
|
|
60
|
+
const file = sources.has(from) && !modules.has(to) ? filesByPath.get(to) : undefined;
|
|
61
|
+
const source = file === undefined ? undefined : parse(file);
|
|
62
|
+
if (source !== undefined) {
|
|
63
|
+
modules.set(to, source);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return modules;
|
|
67
|
+
}
|
|
55
68
|
//# sourceMappingURL=bundlerSources.js.map
|
|
@@ -1 +1 @@
|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I,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrF,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QACzB,CAAC;IACF,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { SourceFile } from "#rule.ts";
|
|
3
|
+
export interface BundlerTargets {
|
|
4
|
+
readonly entries: readonly string[];
|
|
5
|
+
readonly externals: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function bundlerTargets(file: SourceFile, root: string, directory: string, sources?: ReadonlyMap<string, ts.SourceFile>, modules?: ReadonlyMap<string, ts.SourceFile>): BundlerTargets;
|
|
8
|
+
//# sourceMappingURL=bundlerTargets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerTargets.d.ts","sourceRoot":"","sources":["../../src/adapters/bundlerTargets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAO5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAuB3C,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAqCD,wBAAgB,cAAc,CAC7B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAa,EACvD,OAAO,GAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAW,GACnD,cAAc,CAmChB"}
|
|
@@ -3,6 +3,7 @@ import ts from "typescript";
|
|
|
3
3
|
import { buildEntryPaths } from "#adapters/buildEntryPaths.ts";
|
|
4
4
|
import { buildEntryValue, buildOption } from "#adapters/buildEntryValue.ts";
|
|
5
5
|
import { buildArguments, buildHelper } from "#adapters/buildHelper.ts";
|
|
6
|
+
import { bundlerExternals } from "#adapters/bundlerExternals.ts";
|
|
6
7
|
import { importedCall } from "#adapters/importedCall.ts";
|
|
7
8
|
import { mappedBuildBindings } from "#adapters/mappedBuildBindings.ts";
|
|
8
9
|
import { parse } from "#rules/parse.ts";
|
|
@@ -23,21 +24,20 @@ function entryOption(call) {
|
|
|
23
24
|
}
|
|
24
25
|
return imported?.module === "esbuild" && ESBUILD.has(imported.name) ? "entryPoints" : undefined;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function buildConfigs(call, bindings) {
|
|
27
28
|
const option = entryOption(call);
|
|
28
29
|
const [argument] = call.arguments;
|
|
29
|
-
const
|
|
30
|
-
if (option === undefined ||
|
|
30
|
+
const value = argument === undefined ? undefined : buildEntryValue(argument, new Set(), bindings);
|
|
31
|
+
if (option === undefined || value === undefined) {
|
|
31
32
|
return [];
|
|
32
33
|
}
|
|
33
|
-
const configs = option === "input" && ts.isArrayLiteralExpression(
|
|
34
|
-
return configs.flatMap((config) =>
|
|
34
|
+
const configs = option === "input" && ts.isArrayLiteralExpression(value) ? value.elements : [value];
|
|
35
|
+
return configs.flatMap((config) => {
|
|
36
|
+
const options = buildEntryValue(config, new Set(), bindings);
|
|
37
|
+
return ts.isObjectLiteralExpression(options) ? [{ option, options }] : [];
|
|
38
|
+
});
|
|
35
39
|
}
|
|
36
|
-
function configuredEntries(
|
|
37
|
-
const options = buildEntryValue(value, new Set(), bindings);
|
|
38
|
-
if (!ts.isObjectLiteralExpression(options)) {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
40
|
+
function configuredEntries(options, option, cwd, root, bindings) {
|
|
41
41
|
const directory = buildOption(options, "absWorkingDir");
|
|
42
42
|
const working = directory === undefined ? cwd : buildEntryPaths(directory, cwd, root, new Set(), bindings)[0];
|
|
43
43
|
if (working === undefined) {
|
|
@@ -46,12 +46,13 @@ function configuredEntries(value, option, cwd, root, bindings) {
|
|
|
46
46
|
const entries = buildOption(options, option);
|
|
47
47
|
return entries === undefined ? [] : buildEntryPaths(entries, cwd, root, new Set(), bindings).map((path) => posix.resolve(cwd, working, path));
|
|
48
48
|
}
|
|
49
|
-
export function
|
|
49
|
+
export function bundlerTargets(file, root, directory, sources = new Map(), modules = sources) {
|
|
50
50
|
const source = sources.get(file.path) ?? parse(file);
|
|
51
51
|
if (source === undefined) {
|
|
52
|
-
return [];
|
|
52
|
+
return { entries: [], externals: [] };
|
|
53
53
|
}
|
|
54
54
|
const entries = [];
|
|
55
|
+
const externals = [];
|
|
55
56
|
function visit(node, bindings, active) {
|
|
56
57
|
if (ts.isFunctionLike(node)) {
|
|
57
58
|
const body = callbackBody(node);
|
|
@@ -63,7 +64,9 @@ export function bundlerEntries(file, root, directory, sources = new Map()) {
|
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
if (ts.isCallExpression(node)) {
|
|
66
|
-
|
|
67
|
+
const configs = buildConfigs(node, bindings);
|
|
68
|
+
entries.push(...configs.flatMap(({ option, options }) => configuredEntries(options, option, posix.join(root, directory), root, bindings).map((path) => posix.relative(root, path))));
|
|
69
|
+
externals.push(...configs.flatMap(({ options }) => bundlerExternals(options, bindings, modules)));
|
|
67
70
|
const helper = buildHelper(node, sources, bindings);
|
|
68
71
|
if (helper?.body !== undefined && !active.has(helper)) {
|
|
69
72
|
entries.push(posix.relative(root, posix.resolve(root, helper.getSourceFile().fileName)));
|
|
@@ -73,6 +76,6 @@ export function bundlerEntries(file, root, directory, sources = new Map()) {
|
|
|
73
76
|
ts.forEachChild(node, (child) => visit(child, bindings, active));
|
|
74
77
|
}
|
|
75
78
|
visit(source, new Map(), new Set());
|
|
76
|
-
return entries;
|
|
79
|
+
return { entries, externals };
|
|
77
80
|
}
|
|
78
|
-
//# sourceMappingURL=
|
|
81
|
+
//# sourceMappingURL=bundlerTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundlerTargets.js","sourceRoot":"","sources":["../../src/adapters/bundlerTargets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAsB,eAAe,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3D,SAAS,YAAY,CAAC,IAAa;IAClC,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAA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AC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
+
export declare function importedName(expression: ts.LeftHandSideExpression): {
|
|
3
|
+
readonly module: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
} | undefined;
|
|
2
6
|
export declare function importedCall(call: ts.CallExpression): {
|
|
3
7
|
readonly module: string;
|
|
4
8
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importedCall.d.ts","sourceRoot":"","sources":["../../src/adapters/importedCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAe5B,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"importedCall.d.ts","sourceRoot":"","sources":["../../src/adapters/importedCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAe5B,wBAAgB,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,sBAAsB,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAWlI;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAEpH"}
|
|
@@ -11,16 +11,19 @@ function calledName(expression, clause) {
|
|
|
11
11
|
const namespace = bindings !== undefined && ts.isNamespaceImport(bindings) ? bindings.name.text : clause.name?.text;
|
|
12
12
|
return namespace === expression.expression.text ? expression.name.text : undefined;
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
15
|
-
for (const statement of
|
|
14
|
+
export function importedName(expression) {
|
|
15
|
+
for (const statement of expression.getSourceFile().statements) {
|
|
16
16
|
if (!(ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)) || statement.importClause === undefined) {
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
|
-
const name = calledName(
|
|
19
|
+
const name = calledName(expression, statement.importClause);
|
|
20
20
|
if (name !== undefined) {
|
|
21
21
|
return { module: statement.moduleSpecifier.text, name };
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
return undefined;
|
|
25
25
|
}
|
|
26
|
+
export function importedCall(call) {
|
|
27
|
+
return importedName(call.expression);
|
|
28
|
+
}
|
|
26
29
|
//# sourceMappingURL=importedCall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importedCall.js","sourceRoot":"","sources":["../../src/adapters/importedCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,UAAU,CAAC,UAAqC,EAAE,MAAuB;IACjF,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC;IACtC,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,QAAQ,KAAK,SAAS,IAAI,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1F,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5F,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;IAC3F,CAAC;IACD,IAAI,CAAC,CAAC,EAAE,CAAC,0BAA0B,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC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CAAC;
|
|
1
|
+
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/departures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAuC3C,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,SAAS,EAAE,CAY1G"}
|
|
@@ -2,6 +2,7 @@ import { realpathSync } from "node:fs";
|
|
|
2
2
|
import { posix } from "node:path";
|
|
3
3
|
import { projectsFor } from "#adapters/imports/projects.ts";
|
|
4
4
|
import { resolveImport } from "#adapters/imports/resolve.ts";
|
|
5
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
5
6
|
import { specifierSites } from "#imports/specifiers.ts";
|
|
6
7
|
import { packageOf } from "#imports/workspace.ts";
|
|
7
8
|
import { parse } from "#rules/parse.ts";
|
|
@@ -20,7 +21,12 @@ function departureAt(context, site) {
|
|
|
20
21
|
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
21
22
|
const local = target?.kind === "file" ? target.path : undefined;
|
|
22
23
|
const owner = local === undefined ? undefined : packageOf(context.packages, local);
|
|
23
|
-
const
|
|
24
|
+
const home = packageOf(context.packages, context.path);
|
|
25
|
+
const directory = home?.directory ?? ".";
|
|
26
|
+
if (local !== undefined && isPackageRootConfig(directory, context.path) && isPackageRootConfig(directory, local)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const workspace = owner !== undefined && owner !== home ? owner.name : undefined;
|
|
24
30
|
return { ...site, file: context.path, installed: target?.kind === "external" ? target.package : undefined, workspace };
|
|
25
31
|
}
|
|
26
32
|
export function departures(inputs, packages) {
|
|
@@ -1 +1 @@
|
|
|
1
|
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C,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isToolConfig.d.ts","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isToolConfig.d.ts","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import preset from "#biome-preset" with { type: "json" };
|
|
3
|
-
const PATTERNS =
|
|
3
|
+
const PATTERNS = [
|
|
4
|
+
...preset.overrides.flatMap((override) => override.includes.includes("**/*.config.*") && override.linter?.rules?.style?.noDefaultExport === "off" ? override.includes : []),
|
|
5
|
+
// @shivaedev/deploy loads this module from its default path, so no import reaches it.
|
|
6
|
+
"**/.railway/postgres-schedules.ts",
|
|
7
|
+
];
|
|
4
8
|
export function isToolConfig(path) {
|
|
5
9
|
return PATTERNS.some((pattern) => posix.matchesGlob(path, pattern));
|
|
6
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isToolConfig.js","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEzD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"isToolConfig.js","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEzD,MAAM,QAAQ,GAAG;IAChB,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAChI;IACD,sFAAsF;IACtF,mCAAmC;CACnC,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ReachableBuilds } from "#adapters/reachableBuilds.ts";
|
|
1
2
|
import type { RuleInputs } from "#rule.ts";
|
|
2
3
|
export declare function declaredEntries(inputs: RuleInputs): readonly string[];
|
|
3
|
-
export declare function knipConfiguration(inputs: RuleInputs, toolOwned?: readonly string[],
|
|
4
|
+
export declare function knipConfiguration(inputs: RuleInputs, toolOwned?: readonly string[], builds?: ReachableBuilds, declared?: readonly string[]): Promise<{
|
|
4
5
|
exclude: never[];
|
|
5
6
|
ignore: never[];
|
|
6
7
|
ignoreBinaries: never[];
|
|
@@ -20,6 +21,7 @@ export declare function knipConfiguration(inputs: RuleInputs, toolOwned?: readon
|
|
|
20
21
|
workspaces: {
|
|
21
22
|
[k: string]: {
|
|
22
23
|
readonly entry: readonly string[];
|
|
24
|
+
readonly ignoreDependencies: readonly string[];
|
|
23
25
|
readonly paths: {
|
|
24
26
|
[k: string]: string[];
|
|
25
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/configuration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/configuration.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,MAAM,EAAE,CAQrE;AA0BD,wBAAsB,iBAAiB,CACtC,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,SAAS,MAAM,EAAO,EACjC,MAAM,GAAE,eAA8D,EACtE,QAAQ,GAAE,SAAS,MAAM,EAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;yBAoDxC,MAAM;;;;GAqBnB"}
|