@systemfsoftware/arethetypeswrong-core 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +142 -8
- package/dist/index.d.ts +124 -44
- package/dist/index.mjs +852 -411
- package/package.json +9 -10
- package/src/CheckPackage.ts +98 -96
- package/src/CheckPackageExecutor.ts +3 -4
- package/src/CreatePackage.ts +80 -282
- package/src/PackageSpec.schema.ts +9 -0
- package/src/PackageSpec.ts +3 -9
- package/src/index.ts +4 -1
- package/src/internal/DefineCheck.ts +24 -6
- package/src/internal/GetEntrypointInfo.ts +79 -76
- package/src/internal/GetProbableExports.ts +18 -10
- package/src/internal/MinimalLibDts.ts +1 -0
- package/src/internal/MultiCompilerHost.ts +255 -229
- package/src/internal/TsCompat.ts +56 -0
- package/src/internal/TsInternals.d.ts +122 -0
- package/src/internal/checks/CjsOnlyExportsDefault.ts +1 -0
- package/src/internal/checks/EntrypointResolutions.ts +1 -0
- package/src/internal/checks/ExportDefaultDisagreement.ts +119 -183
- package/src/internal/checks/InternalResolutionError.ts +1 -0
- package/src/internal/checks/ModuleKindDisagreement.ts +1 -0
- package/src/internal/checks/NamedExports.ts +34 -25
- package/src/internal/checks/UnexpectedModuleSyntax.ts +1 -0
- package/src/internal/checks/index.ts +1 -0
- package/src/internal/esm/CjsBindings.ts +1 -0
- package/src/internal/esm/CjsNamespace.ts +1 -0
- package/src/internal/esm/EsmBindings.ts +5 -3
- package/src/internal/esm/EsmNamespace.ts +1 -0
- package/src/internal/esm/Resolve.ts +2 -0
- package/src/pack.ts +133 -0
- package/src/recipes.ts +354 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @systemfsoftware/arethetypeswrong-core
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- checkPackage now returns an Effect. Run the Effect instead of awaiting a Promise. The package no longer installs lru-cache.
|
|
8
|
+
|
|
9
|
+
- `PackageSpecParseError` is a class you construct rather than a function you call.
|
|
10
|
+
|
|
11
|
+
Build one with `new PackageSpecParseError({ message })` where you previously called
|
|
12
|
+
`PackageSpecParseError(message)`. The tag and the `message` field are unchanged, and
|
|
13
|
+
`parsePackageSpec` still fails with it — code that only reads the failure needs no edit.
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- `checkPackage` can now analyse a package built entirely in memory. `createPackage` builds a `Package` from an authored file tree without a tarball, `toDirectoryJSON` renders the same tree for an in-memory filesystem, and `recipes` provides ready-made example packages covering each kind of type-resolution problem the tool reports. `packPackage` and `packTree` turn a built package back into tarball bytes without invoking `npm pack`.
|
|
18
|
+
|
|
19
|
+
- The `Package` class is now a public export. Construct it directly when a test or tool needs a package fixture without going through a tarball.
|
|
20
|
+
|
|
3
21
|
## 3.0.0
|
|
4
22
|
|
|
5
23
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -1,17 +1,151 @@
|
|
|
1
1
|
# @systemfsoftware/arethetypeswrong-core
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
> The analysis engine behind [arethetypeswrong.github.io](https://arethetypeswrong.github.io) — check an npm tarball's entry points, module kinds, and export bindings before you publish.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Analyzes a package tarball the way Node and TypeScript will actually resolve it: entry-point discovery from `package.json` (`main`, `exports`, `bin`), per-entry `commonjs` / `ESM` resolution, and export-shape checks. Use it to catch publish-time mistakes locally instead of after `npm publish`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> This package is pre-1.0 (`3.0.0` under `v0` semver). Patch and minor releases may change the public API. Pin the version in production.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## What it does
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
A single `checkPackage` call returns a structured analysis or a set of diagnostics. Each entry point is checked under every relevant resolution kind:
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
- **Entrypoint resolution** — does every `exports` subpath, `main`, and `bin` target resolve to a file that exists, and are `null`-target exclusions pruned correctly?
|
|
15
|
+
- **Module-kind agreement** — does the file's actual module kind (`commonjs` vs `ESM` vs `JSON`) match what the package's `type` and file extension imply?
|
|
16
|
+
- **Export bindings** — do named exports, default exports, and `export =` / `module.exports` line up between the type and implementation entry points?
|
|
17
|
+
- **CJS-only default** — flags a CJS file that only exports a default where an `esModuleInterop` consumer would get a wrapper.
|
|
18
|
+
- **Unexpected module syntax** — flags `import`/`export` in a CJS context and `require`/`module.exports` in an ESM context at the reported `pos`/`end`.
|
|
19
|
+
- **Internal resolution errors** — surfaces TypeScript's own resolution failures with the failing specifier and mode.
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
Results are typed with Effect Schema and carry `pos`/`end` for precise diagnostics.
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm add @systemfsoftware/arethetypeswrong-core
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @systemfsoftware/arethetypeswrong-core
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Requires Node `>=24` and `typescript@6.0.3` on the `catalog:attw` line (the 6.x JS bridge — see [TypeScript version](#typescript-version)).
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
Check an in-memory package:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { checkPackage, createPackage } from '@systemfsoftware/arethetypeswrong-core'
|
|
41
|
+
|
|
42
|
+
const pkg = createPackage(
|
|
43
|
+
{
|
|
44
|
+
'package.json': JSON.stringify({ name: 'demo', version: '1.0.0', type: 'module' }),
|
|
45
|
+
'index.d.ts': 'export declare const x: number',
|
|
46
|
+
'index.js': 'export const x = 1',
|
|
47
|
+
},
|
|
48
|
+
'demo',
|
|
49
|
+
'1.0.0',
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
const result = await checkPackage(pkg)
|
|
53
|
+
|
|
54
|
+
if ('entrypoints' in result) {
|
|
55
|
+
console.log(Object.keys(result.entrypoints))
|
|
56
|
+
// e.g. [ ".", "./utils", "./features/*.js" ]
|
|
57
|
+
} else {
|
|
58
|
+
for (const problem of result.problems) {
|
|
59
|
+
console.error(problem.kind, problem.entrypoint, problem.pos)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Mount the same tree on an in-memory filesystem (keys stay `/node_modules/<name>/…`):
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { toDirectoryJSON } from '@systemfsoftware/arethetypeswrong-core'
|
|
68
|
+
import { MemoryFileSystem } from '@systemfsoftware/effect-memfs'
|
|
69
|
+
import { Effect } from 'effect'
|
|
70
|
+
|
|
71
|
+
const tree = {
|
|
72
|
+
'package.json': JSON.stringify({ name: 'demo', version: '1.0.0' }),
|
|
73
|
+
'index.js': 'export const x = 1',
|
|
74
|
+
}
|
|
75
|
+
const contents = toDirectoryJSON(tree, 'demo')
|
|
76
|
+
// `contents` is a plain `Record<string, string>` like `{ '/node_modules/demo/package.json': '...' }`
|
|
77
|
+
const fs = MemoryFileSystem.make(contents as never)
|
|
78
|
+
const bytes = await Effect.runPromise(fs.readFile('/node_modules/demo/package.json'))
|
|
79
|
+
const text = new TextDecoder().decode(bytes)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Check a real tarball on disk:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { checkPackage, createPackageFromTarballData } from '@systemfsoftware/arethetypeswrong-core'
|
|
86
|
+
import { readFile } from 'node:fs/promises'
|
|
87
|
+
|
|
88
|
+
const data = await readFile('./my-package-1.2.3.tgz')
|
|
89
|
+
const pkg = createPackageFromTarballData(data)
|
|
90
|
+
const analysis = await checkPackage(pkg)
|
|
91
|
+
// `analysis` is `Analysis` with `entrypoints` or `problems`
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Filter entry points:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const result = await checkPackage(pkg, {
|
|
98
|
+
includeEntrypoints: ['./utils'],
|
|
99
|
+
excludeEntrypoints: [/^.\/internal\//],
|
|
100
|
+
entrypoints: ['.', './cli'], // exhaustive override
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Prefer the CLI for one-off checks:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pnpm dlx @systemfsoftware/arethetypeswrong-cli ./my-package-1.2.3.tgz
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Checks
|
|
111
|
+
|
|
112
|
+
| Check | What it reports |
|
|
113
|
+
| --------------------------- | ------------------------------------------------------------------------ |
|
|
114
|
+
| `entrypointResolutions` | Missing or mis-resolving entry points from `exports` / `main` / `bin` |
|
|
115
|
+
| `moduleKindDisagreement` | File extension/`type` says ESM but file is CJS (or vice versa) |
|
|
116
|
+
| `exportDefaultDisagreement` | `export default` present in types but not JS (or the reverse) |
|
|
117
|
+
| `namedExports` | Named export in types but not in JS (or the reverse) |
|
|
118
|
+
| `cjsOnlyExportsDefault` | CJS file that only has `module.exports =` / `exports.default` |
|
|
119
|
+
| `unexpectedModuleSyntax` | ESM syntax in a CJS file or CJS syntax in an ESM file |
|
|
120
|
+
| `internalResolutionError` | TypeScript failed to resolve a specifier under a given `resolution-mode` |
|
|
121
|
+
|
|
122
|
+
Each diagnostic includes `kind`, `entrypoint`, `resolutionKind` (`node10` / `node16` / `bundler`), and `pos`/`end` when applicable. See [`Problem.schema.ts`](./src/Problem.schema.ts) and [`Analysis.schema.ts`](./src/Analysis.schema.ts) for the full types.
|
|
123
|
+
|
|
124
|
+
## Configuration
|
|
125
|
+
|
|
126
|
+
No configuration file is required. Options are passed per call:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
type CheckPackageOptions = {
|
|
130
|
+
entrypoints?: string[] // exhaustive list, disables auto-discovery
|
|
131
|
+
includeEntrypoints?: string[] // added to discovered entry points
|
|
132
|
+
excludeEntrypoints?: (string | RegExp)[] // removed after discovery
|
|
133
|
+
entrypointsLegacy?: boolean // also consider all published files
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Entrypoint discovery reads `package.json` `exports`, `main`, `bin`, and `types`/`typings`. Published files are those not excluded by `.npmignore` / `files` / `.gitignore` semantics.
|
|
138
|
+
|
|
139
|
+
## TypeScript version
|
|
140
|
+
|
|
141
|
+
This package runs on the **TypeScript 6.x JS bridge** (`typescript@^6.0.3` via `catalog:attw`). TypeScript 7 is a native Go compiler with no JS `createProgram` / `resolveModuleName` / `CompilerHost` API, so the analysis engine cannot run on it. The bridge line is the last TypeScript with the full JS compiler surface. Majors are never automated — see [`.github/dependabot.yml`](../../../.github/dependabot.yml) and the decision record at [`docs/solutions/tooling-decisions/arethetypeswrong-core-requires-js-typescript-api.md`](../../../docs/solutions/tooling-decisions/arethetypeswrong-core-requires-js-typescript-api.md).
|
|
142
|
+
|
|
143
|
+
Snapshot fixtures (`moment@2.29.1`, `react@18.2.0`) embed the compiler version in resolution traces and were regenerated for `6.0.3`.
|
|
144
|
+
|
|
145
|
+
## Contributing
|
|
146
|
+
|
|
147
|
+
Development setup, build, and test workflow: [`AGENTS.md`](./AGENTS.md).
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
[Apache-2.0](../../../LICENSE) — same as the upstream `arethetypeswrong.github.io`.
|
package/dist/index.d.ts
CHANGED
|
@@ -560,6 +560,60 @@ declare const getBuildTools: (packageJson: {
|
|
|
560
560
|
devDependencies?: Record<string, string>;
|
|
561
561
|
}) => Partial<Record<BuildTool, string>>;
|
|
562
562
|
//#endregion
|
|
563
|
+
//#region src/CreatePackage.d.ts
|
|
564
|
+
declare class Package {
|
|
565
|
+
#private;
|
|
566
|
+
readonly packageName: string;
|
|
567
|
+
readonly packageVersion: string;
|
|
568
|
+
readonly resolvedUrl?: string;
|
|
569
|
+
readonly typesPackage?: {
|
|
570
|
+
packageName: string;
|
|
571
|
+
packageVersion: string;
|
|
572
|
+
resolvedUrl?: string;
|
|
573
|
+
};
|
|
574
|
+
constructor(files: Record<string, string | Uint8Array>, packageName: string, packageVersion: string, resolvedUrl?: string, typesPackage?: Package['typesPackage']);
|
|
575
|
+
tryReadBytes(path: string): string | Uint8Array | undefined;
|
|
576
|
+
tryReadFile(path: string): string | undefined;
|
|
577
|
+
readFile(path: string): string;
|
|
578
|
+
fileExists(path: string): boolean;
|
|
579
|
+
directoryExists(path: string): boolean;
|
|
580
|
+
containsTypes(directory?: string): boolean;
|
|
581
|
+
listFiles(directory?: string): string[];
|
|
582
|
+
mergedWithTypes(typesPackage: Package): Package;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Build a {@link Package} from an authored file tree without a tarball.
|
|
586
|
+
*
|
|
587
|
+
* Tree contract (minor-version stable):
|
|
588
|
+
* - Relative keys are prefixed with `/node_modules/<packageName>/`.
|
|
589
|
+
* - Absolute keys must already use that prefix; scoped names use
|
|
590
|
+
* `/node_modules/@scope/name/`.
|
|
591
|
+
* - File bodies may be `string` or `Uint8Array`.
|
|
592
|
+
* - A tree with no `package.json` at `/node_modules/<packageName>/package.json`
|
|
593
|
+
* is refused (throws).
|
|
594
|
+
* - If `package.json` content disagrees with the constructor arguments,
|
|
595
|
+
* the constructor arguments win: the returned `Package` keeps
|
|
596
|
+
* `packageName`/`packageVersion` as given, and the file tree's
|
|
597
|
+
* `package.json` text is left as authored.
|
|
598
|
+
*/
|
|
599
|
+
declare function createPackage(files: Record<string, string | Uint8Array>, packageName?: string, packageVersion?: string): Package;
|
|
600
|
+
type DirectoryJSON = Record<string, string | Uint8Array | null>;
|
|
601
|
+
/**
|
|
602
|
+
* Project an authored package tree to a memfs {@link DirectoryJSON} that
|
|
603
|
+
* {@link MemoryFileSystem.make} accepts.
|
|
604
|
+
*
|
|
605
|
+
* Keys are kept as `/node_modules/<packageName>/…` (the same prefix
|
|
606
|
+
* `createPackage` uses). Relative keys are prefixed; absolute keys must
|
|
607
|
+
* already use that prefix. Bodies are preserved: `string` stays a string,
|
|
608
|
+
* `Uint8Array` is converted to a `Buffer` so `memfs` treats it as file
|
|
609
|
+
* content rather than a directory entry.
|
|
610
|
+
*
|
|
611
|
+
* Core does not depend on `@systemfsoftware/effect-memfs` — this returns a
|
|
612
|
+
* plain record that is structurally compatible with `Contents`.
|
|
613
|
+
*/
|
|
614
|
+
declare function toDirectoryJSON(files: Record<string, string | Uint8Array>, packageName?: string): DirectoryJSON;
|
|
615
|
+
declare function createPackageFromTarballData(tarball: Uint8Array): Package;
|
|
616
|
+
//#endregion
|
|
563
617
|
//#region src/Types.d.ts
|
|
564
618
|
type ResolutionKind$1 = 'node10' | 'node16-cjs' | 'node16-esm' | 'bundler';
|
|
565
619
|
type ResolutionOption$1 = 'node10' | 'node16' | 'bundler';
|
|
@@ -683,51 +737,14 @@ interface CJSOnlyExportsDefaultProblem$1 extends FileTextRangeProblem {
|
|
|
683
737
|
}
|
|
684
738
|
type Problem$1 = NoResolutionProblem$1 | UntypedResolutionProblem$1 | FalseESMProblem$1 | FalseCJSProblem$1 | CJSResolvesToESMProblem$1 | NamedExportsProblem$1 | FallbackConditionProblem$1 | FalseExportDefaultProblem$1 | MissingExportEqualsProblem$1 | InternalResolutionErrorProblem$1 | UnexpectedModuleSyntaxProblem$1 | CJSOnlyExportsDefaultProblem$1;
|
|
685
739
|
//#endregion
|
|
686
|
-
//#region src/CreatePackage.d.ts
|
|
687
|
-
declare class Package {
|
|
688
|
-
#private;
|
|
689
|
-
readonly packageName: string;
|
|
690
|
-
readonly packageVersion: string;
|
|
691
|
-
readonly resolvedUrl?: string;
|
|
692
|
-
readonly typesPackage?: {
|
|
693
|
-
packageName: string;
|
|
694
|
-
packageVersion: string;
|
|
695
|
-
resolvedUrl?: string;
|
|
696
|
-
};
|
|
697
|
-
constructor(files: Record<string, string | Uint8Array>, packageName: string, packageVersion: string, resolvedUrl?: string, typesPackage?: Package['typesPackage']);
|
|
698
|
-
tryReadFile(path: string): string | undefined;
|
|
699
|
-
readFile(path: string): string;
|
|
700
|
-
fileExists(path: string): boolean;
|
|
701
|
-
directoryExists(path: string): boolean;
|
|
702
|
-
containsTypes(directory?: string): boolean;
|
|
703
|
-
listFiles(directory?: string): string[];
|
|
704
|
-
mergedWithTypes(typesPackage: Package): Package;
|
|
705
|
-
}
|
|
706
|
-
declare function createPackageFromTarballData(tarball: Uint8Array): Package;
|
|
707
|
-
//#endregion
|
|
708
740
|
//#region src/CheckPackage.d.ts
|
|
709
741
|
interface CheckPackageOptions {
|
|
710
|
-
/**
|
|
711
|
-
* Exhaustive list of entrypoints to check. The package root is `"."`.
|
|
712
|
-
* Specifying this option disables automatic entrypoint discovery,
|
|
713
|
-
* and overrides the `includeEntrypoints` and `excludeEntrypoints` options.
|
|
714
|
-
*/
|
|
715
742
|
entrypoints?: string[];
|
|
716
|
-
/**
|
|
717
|
-
* Entrypoints to check in addition to automatically discovered ones.
|
|
718
|
-
*/
|
|
719
743
|
includeEntrypoints?: string[];
|
|
720
|
-
/**
|
|
721
|
-
* Entrypoints to exclude from checking.
|
|
722
|
-
*/
|
|
723
744
|
excludeEntrypoints?: (string | RegExp)[];
|
|
724
|
-
/**
|
|
725
|
-
* Whether to automatically consider all published files as entrypoints
|
|
726
|
-
* in the absence of any other detected or configured entrypoints.
|
|
727
|
-
*/
|
|
728
745
|
entrypointsLegacy?: boolean;
|
|
729
746
|
}
|
|
730
|
-
declare
|
|
747
|
+
declare const checkPackage: (pkg: Package, options?: CheckPackageOptions) => Effect.Effect<CheckResult$1, Error>;
|
|
731
748
|
//#endregion
|
|
732
749
|
//#region src/PackageSpec.schema.d.ts
|
|
733
750
|
declare const PackageSpecVersionKindSchema: Schema.Literals<readonly ["none", "exact", "range", "tag"]>;
|
|
@@ -738,6 +755,14 @@ declare const ParsedPackageSpecSchema: Schema.Struct<{
|
|
|
738
755
|
readonly version: Schema.String;
|
|
739
756
|
}>;
|
|
740
757
|
type ParsedPackageSpec = Schema.Schema.Type<typeof ParsedPackageSpecSchema>;
|
|
758
|
+
declare const PackageSpecParseError_base: Schema.Class<PackageSpecParseError, Schema.TaggedStruct<"PackageSpecParseError", {
|
|
759
|
+
readonly message: Schema.String;
|
|
760
|
+
}>, import("effect/Cause").YieldableError>;
|
|
761
|
+
/**
|
|
762
|
+
* Refusal a specifier parse returns: the specifier named no valid package, or
|
|
763
|
+
* carried a version that was neither an exact version nor a range.
|
|
764
|
+
*/
|
|
765
|
+
declare class PackageSpecParseError extends PackageSpecParseError_base {}
|
|
741
766
|
//#endregion
|
|
742
767
|
//#region src/PackageStore.schema.d.ts
|
|
743
768
|
declare const PackageNotFoundError_base: Schema.Class<PackageNotFoundError, Schema.TaggedStruct<"PackageNotFoundError", {
|
|
@@ -824,12 +849,22 @@ interface ModuleKindDisagreementInput {
|
|
|
824
849
|
}
|
|
825
850
|
declare const detectModuleKindDisagreement: (input: ModuleKindDisagreementInput) => FalseESMProblem | FalseCJSProblem | undefined;
|
|
826
851
|
//#endregion
|
|
852
|
+
//#region src/pack.d.ts
|
|
853
|
+
/**
|
|
854
|
+
* In-process ustar + Gzip (fflate) packer.
|
|
855
|
+
*
|
|
856
|
+
* - Sorted entry names
|
|
857
|
+
* - mtime 0
|
|
858
|
+
* - `package/` prefix as npm pack does
|
|
859
|
+
*/
|
|
860
|
+
declare function packPackage(pkg: Package): Uint8Array;
|
|
861
|
+
/**
|
|
862
|
+
* Pack an authored file tree directly. Useful for GlobalSetup and tests that
|
|
863
|
+
* want to avoid the Package mutation of Uint8Array bodies.
|
|
864
|
+
*/
|
|
865
|
+
declare function packTree(files: Record<string, string | Uint8Array>, packageName: string): Uint8Array;
|
|
866
|
+
//#endregion
|
|
827
867
|
//#region src/PackageSpec.d.ts
|
|
828
|
-
type PackageSpecParseError = {
|
|
829
|
-
readonly _tag: 'PackageSpecParseError';
|
|
830
|
-
readonly message: string;
|
|
831
|
-
};
|
|
832
|
-
declare const PackageSpecParseError: (message: string) => PackageSpecParseError;
|
|
833
868
|
declare const parsePackageSpec: (input: string) => Result.Result<ParsedPackageSpec, PackageSpecParseError>;
|
|
834
869
|
//#endregion
|
|
835
870
|
//#region src/ProblemInfo.d.ts
|
|
@@ -856,6 +891,51 @@ declare const groupProblemsByKind: <K extends ProblemKind>(problems: readonly (P
|
|
|
856
891
|
kind: K;
|
|
857
892
|
})[]>>;
|
|
858
893
|
//#endregion
|
|
894
|
+
//#region src/recipes.d.ts
|
|
895
|
+
/**
|
|
896
|
+
* Synthetic problem-class recipes — one per {@link Problem} kind plus
|
|
897
|
+
* a types-companion pair and a known-bad tree.
|
|
898
|
+
*
|
|
899
|
+
* Each entry is a function returning a {@link Package} via the published
|
|
900
|
+
* {@link createPackage} constructor so callers can build fresh instances.
|
|
901
|
+
* The record is the single stability surface for recipe identity; individual
|
|
902
|
+
* kind names are not separate exports.
|
|
903
|
+
*/
|
|
904
|
+
declare const recipes: {
|
|
905
|
+
/** Types file is CJS, implementation is ESM → FalseCJS. */
|
|
906
|
+
FalseCJS: () => Package;
|
|
907
|
+
/** Types file is ESM, implementation is CJS → FalseESM. */
|
|
908
|
+
FalseESM: () => Package;
|
|
909
|
+
/** Node16 CJS resolution lands on an ESM file → CJSResolvesToESM. */
|
|
910
|
+
CJSResolvesToESM: () => Package;
|
|
911
|
+
/** Types has named exports missing in ESM impl → NamedExports. */
|
|
912
|
+
NamedExports: () => Package;
|
|
913
|
+
/** Resolution fell through a conditional export fallback → FallbackCondition. */
|
|
914
|
+
FallbackCondition: () => Package;
|
|
915
|
+
/** Types has default, impl lacks default → FalseExportDefault. */
|
|
916
|
+
FalseExportDefault: () => Package;
|
|
917
|
+
/** Types lacks `export =` but impl has it (callable) → MissingExportEquals. */
|
|
918
|
+
MissingExportEquals: () => Package;
|
|
919
|
+
/** Internal relative import fails to resolve → InternalResolutionError. */
|
|
920
|
+
InternalResolutionError: () => Package;
|
|
921
|
+
/** File syntax disagrees with its detected module kind → UnexpectedModuleSyntax. */
|
|
922
|
+
UnexpectedModuleSyntax: () => Package;
|
|
923
|
+
/** CJS file seen only via ESM resolution has `module.exports.default` → CJSOnlyExportsDefault. */
|
|
924
|
+
CJSOnlyExportsDefault: () => Package;
|
|
925
|
+
/** Entrypoint resolves to nothing → NoResolution. */
|
|
926
|
+
NoResolution: () => Package;
|
|
927
|
+
/** Entrypoint resolves to JS without types → UntypedResolution. */
|
|
928
|
+
UntypedResolution: () => Package;
|
|
929
|
+
/** Main package of the types-companion pair (no types of its own). */
|
|
930
|
+
TypesCompanion: () => Package;
|
|
931
|
+
/** types companion for the pair above. */
|
|
932
|
+
TypesCompanionTypes: () => Package;
|
|
933
|
+
/** Analysis rejects this tree (invalid package.json) → Result.fail. */
|
|
934
|
+
KnownBad: () => Package;
|
|
935
|
+
/** Multiple entrypoints including `macros` for CLI contract lane. */
|
|
936
|
+
MultiEntrypoint: () => Package;
|
|
937
|
+
};
|
|
938
|
+
//#endregion
|
|
859
939
|
//#region src/ResolutionKind.d.ts
|
|
860
940
|
declare const allResolutionOptions: readonly ResolutionOption[];
|
|
861
941
|
declare const allResolutionKinds: readonly ResolutionKind[];
|
|
@@ -916,4 +996,4 @@ declare const TypescriptAdapter_base: Context.ServiceClass<TypescriptAdapter, "@
|
|
|
916
996
|
declare class TypescriptAdapter extends TypescriptAdapter_base {}
|
|
917
997
|
declare const TypescriptAdapterStub: Layer.Layer<TypescriptAdapter, never, never>;
|
|
918
998
|
//#endregion
|
|
919
|
-
export { Analysis, AnalysisSchema, AnalysisTypes, AnalysisTypesSchema, Analysis_, BuildTool, BuildToolSchema, CJSOnlyExportsDefaultProblem, CJSOnlyExportsDefaultProblemSchema, CJSResolvesToESMProblem, CJSResolvesToESMProblemSchema, CheckPackage, CheckPackageLive, CheckPackageService, CheckResult, CheckResultSchema, CommonJSModuleKind, ESNextModuleKind, EntrypointInfo, EntrypointInfoSchema, EntrypointResolutionAnalysis, EntrypointResolutionAnalysisSchema, EntrypointResolutionsInput, ExtractedTarball, FallbackConditionProblem, FallbackConditionProblemSchema, FalseCJSProblem, FalseCJSProblemSchema, FalseESMProblem, FalseESMProblemSchema, FalseExportDefaultProblem, FalseExportDefaultProblemSchema, IncludedTypesSchema, InternalResolutionErrorProblem, InternalResolutionErrorProblemSchema, LexerAdapter, LexerAdapterService, LexerAdapterStub, MissingExportEqualsProblem, MissingExportEqualsProblemSchema, ModuleKind, ModuleKindDisagreementInput, ModuleKindReason, ModuleKindReasonSchema, ModuleKindSchema, ModuleKindSyntax, ModuleKindSyntaxSchema, NamedExportsProblem, NamedExportsProblemSchema, NoResolutionProblem, NoResolutionProblemSchema, PackageNotFoundError, PackageSpecParseError, PackageSpecVersionKind, PackageSpecVersionKindSchema, PackageStoreAdapter, PackageStoreAdapterLive, PackageStoreAdapterService, PackageStoreAdapterStub, PackageStoreError, PackageStoreOptions, PackageStoreTarballRef, ParsedPackageSpec, ParsedPackageSpecSchema, Problem, ProblemFilter, ProblemKind, ProblemKindInfo, ProblemKindSchema, ProblemSchema, ProgramInfo, ProgramInfoSchema, Resolution, ResolutionKind, ResolutionKindSchema, ResolutionOption, ResolutionOptionSchema, ResolutionSchema, ResolveModuleNameResult, ResolverAdapter, ResolverAdapterService, ResolverAdapterStub, ResolverResolution, TarballAdapter, TarballAdapterError, TarballAdapterLive, TarballAdapterService, TarballAdapterStub, TarballFile, TypesPackageSchema, TypescriptAdapter, TypescriptAdapterService, TypescriptAdapterStub, TypescriptHostHandle, UnexpectedModuleSyntaxProblem, UnexpectedModuleSyntaxProblemSchema, UntypedResolutionProblem, UntypedResolutionProblemSchema, UntypedResult, UntypedResultSchema, _resolutionKindsUsed, _resolutionOptionsUsed, allBuildTools, allProblemKinds, allResolutionKinds, allResolutionOptions, checkPackage, createPackageFromTarballData, detectEntrypointResolutions, detectModuleKindDisagreement, filterProblems, formatEntrypointString, getBuildTools, getResolutionKinds, getResolutionOption, getSubpaths, groupProblemsByKind, hasExportTarget, isDefined, isResolutionKind, isResolutionOption, parsePackageSpec, problemKindInfo, resolvedThroughFallback };
|
|
999
|
+
export { Analysis, AnalysisSchema, AnalysisTypes, AnalysisTypesSchema, Analysis_, BuildTool, BuildToolSchema, CJSOnlyExportsDefaultProblem, CJSOnlyExportsDefaultProblemSchema, CJSResolvesToESMProblem, CJSResolvesToESMProblemSchema, CheckPackage, CheckPackageLive, CheckPackageService, CheckResult, CheckResultSchema, CommonJSModuleKind, type DirectoryJSON, ESNextModuleKind, EntrypointInfo, EntrypointInfoSchema, EntrypointResolutionAnalysis, EntrypointResolutionAnalysisSchema, EntrypointResolutionsInput, ExtractedTarball, FallbackConditionProblem, FallbackConditionProblemSchema, FalseCJSProblem, FalseCJSProblemSchema, FalseESMProblem, FalseESMProblemSchema, FalseExportDefaultProblem, FalseExportDefaultProblemSchema, IncludedTypesSchema, InternalResolutionErrorProblem, InternalResolutionErrorProblemSchema, LexerAdapter, LexerAdapterService, LexerAdapterStub, MissingExportEqualsProblem, MissingExportEqualsProblemSchema, ModuleKind, ModuleKindDisagreementInput, ModuleKindReason, ModuleKindReasonSchema, ModuleKindSchema, ModuleKindSyntax, ModuleKindSyntaxSchema, NamedExportsProblem, NamedExportsProblemSchema, NoResolutionProblem, NoResolutionProblemSchema, Package, PackageNotFoundError, PackageSpecParseError, PackageSpecVersionKind, PackageSpecVersionKindSchema, PackageStoreAdapter, PackageStoreAdapterLive, PackageStoreAdapterService, PackageStoreAdapterStub, PackageStoreError, PackageStoreOptions, PackageStoreTarballRef, ParsedPackageSpec, ParsedPackageSpecSchema, Problem, ProblemFilter, ProblemKind, ProblemKindInfo, ProblemKindSchema, ProblemSchema, ProgramInfo, ProgramInfoSchema, Resolution, ResolutionKind, ResolutionKindSchema, ResolutionOption, ResolutionOptionSchema, ResolutionSchema, ResolveModuleNameResult, ResolverAdapter, ResolverAdapterService, ResolverAdapterStub, ResolverResolution, TarballAdapter, TarballAdapterError, TarballAdapterLive, TarballAdapterService, TarballAdapterStub, TarballFile, TypesPackageSchema, TypescriptAdapter, TypescriptAdapterService, TypescriptAdapterStub, TypescriptHostHandle, UnexpectedModuleSyntaxProblem, UnexpectedModuleSyntaxProblemSchema, UntypedResolutionProblem, UntypedResolutionProblemSchema, UntypedResult, UntypedResultSchema, _resolutionKindsUsed, _resolutionOptionsUsed, allBuildTools, allProblemKinds, allResolutionKinds, allResolutionOptions, checkPackage, createPackage, createPackageFromTarballData, detectEntrypointResolutions, detectModuleKindDisagreement, filterProblems, formatEntrypointString, getBuildTools, getResolutionKinds, getResolutionOption, getSubpaths, groupProblemsByKind, hasExportTarget, isDefined, isResolutionKind, isResolutionOption, packPackage, packTree, parsePackageSpec, problemKindInfo, recipes, resolvedThroughFallback, toDirectoryJSON };
|