@systemfsoftware/arethetypeswrong-core 0.18.5
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/LICENSE +7 -0
- package/README.md +5 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.mjs +1238 -0
- package/dist/problems.d.ts +25 -0
- package/dist/problems.mjs +127 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.mjs +1 -0
- package/dist/utils-B9_TVu9k.d.ts +18 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.mjs +134 -0
- package/dist/versions.d.ts +7 -0
- package/dist/versions.mjs +8 -0
- package/package.json +77 -0
- package/src/checkPackage.ts +129 -0
- package/src/createPackage.ts +322 -0
- package/src/index.ts +3 -0
- package/src/internal/checks/cjsOnlyExportsDefault.ts +52 -0
- package/src/internal/checks/entrypointResolutions.ts +57 -0
- package/src/internal/checks/exportDefaultDisagreement.ts +342 -0
- package/src/internal/checks/index.ts +17 -0
- package/src/internal/checks/internalResolutionError.ts +52 -0
- package/src/internal/checks/moduleKindDisagreement.ts +44 -0
- package/src/internal/checks/namedExports.ts +84 -0
- package/src/internal/checks/unexpectedModuleSyntax.ts +34 -0
- package/src/internal/defineCheck.ts +52 -0
- package/src/internal/esm/cjsBindings.ts +6 -0
- package/src/internal/esm/cjsNamespace.ts +29 -0
- package/src/internal/esm/esmBindings.ts +110 -0
- package/src/internal/esm/esmNamespace.ts +39 -0
- package/src/internal/esm/resolve.ts +21 -0
- package/src/internal/getEntrypointInfo.ts +249 -0
- package/src/internal/getProbableExports.ts +203 -0
- package/src/internal/minimalLibDts.ts +78 -0
- package/src/internal/multiCompilerHost.ts +314 -0
- package/src/problems.ts +201 -0
- package/src/types.ts +188 -0
- package/src/utils.ts +173 -0
- package/src/versions.ts +13 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2023 Andrew Branch
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @systemfsoftware/arethetypeswrong-core
|
|
2
|
+
|
|
3
|
+
The API behind [arethetypeswrong.github.io](https://arethetypeswrong.github.io).
|
|
4
|
+
|
|
5
|
+
⚠️ This package is in major version `v0` and the API may change significantly in patch and minor releases. Use at your own risk. Documentation will not be provided at least until the package reaches version `v1`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Analysis, AnalysisTypes, BuildTool, CJSOnlyExportsDefaultProblem, CJSResolvesToESMProblem, CheckResult, EntrypointInfo, EntrypointResolutionAnalysis, EntrypointResolutionProblem, Failable, FallbackConditionProblem, FalseCJSProblem, FalseESMProblem, FalseExportDefaultProblem, FilePairProblem, FileTextRangeProblem, IncludedTypes, InternalResolutionErrorProblem, MissingExportEqualsProblem, ModuleKind, ModuleKindPairProblem, ModuleKindReason, NamedExportsProblem, NoResolutionProblem, ParsedPackageSpec, Problem, ProblemKind, ProgramInfo, Resolution, ResolutionKind, ResolutionOption, TypesPackage, UnexpectedModuleSyntaxProblem, UntypedResolutionProblem, UntypedResult } from "./types.js";
|
|
2
|
+
import "./utils-B9_TVu9k.js";
|
|
3
|
+
//#region src/createPackage.d.ts
|
|
4
|
+
declare class Package {
|
|
5
|
+
#private;
|
|
6
|
+
readonly packageName: string;
|
|
7
|
+
readonly packageVersion: string;
|
|
8
|
+
readonly resolvedUrl?: string;
|
|
9
|
+
readonly typesPackage?: {
|
|
10
|
+
packageName: string;
|
|
11
|
+
packageVersion: string;
|
|
12
|
+
resolvedUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
constructor(files: Record<string, string | Uint8Array>, packageName: string, packageVersion: string, resolvedUrl?: string, typesPackage?: Package['typesPackage']);
|
|
15
|
+
tryReadFile(path: string): string | undefined;
|
|
16
|
+
readFile(path: string): string;
|
|
17
|
+
fileExists(path: string): boolean;
|
|
18
|
+
directoryExists(path: string): boolean;
|
|
19
|
+
containsTypes(directory?: string): boolean;
|
|
20
|
+
listFiles(directory?: string): string[];
|
|
21
|
+
mergedWithTypes(typesPackage: Package): Package;
|
|
22
|
+
}
|
|
23
|
+
interface CreatePackageFromNpmOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Controls inclusion of a corresponding `@types` package. Ignored if the implementation
|
|
26
|
+
* package contains TypeScript files. The value is the version or SemVer range of the
|
|
27
|
+
* `@types` package to include, `true` to infer the version from the implementation
|
|
28
|
+
* package version, or `false` to prevent inclusion of a `@types` package.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
definitelyTyped?: string | boolean;
|
|
32
|
+
before?: Date;
|
|
33
|
+
allowDeprecated?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare function createPackageFromNpm(packageSpec: string, { definitelyTyped, ...options }?: CreatePackageFromNpmOptions): Promise<Package>;
|
|
36
|
+
declare function resolveImplementationPackageForTypesPackage(typesPackageName: string, typesPackageVersion: string, options?: Omit<CreatePackageFromNpmOptions, 'definitelyTyped'>): Promise<ResolvedPackageId>;
|
|
37
|
+
declare function resolveTypesPackageForPackage(packageName: string, packageVersion: string, options?: Omit<CreatePackageFromNpmOptions, 'definitelyTyped'>): Promise<ResolvedPackageId | undefined>;
|
|
38
|
+
interface ResolvedPackageId {
|
|
39
|
+
packageName: string;
|
|
40
|
+
packageVersion: string;
|
|
41
|
+
tarballUrl: string;
|
|
42
|
+
}
|
|
43
|
+
declare class Npm404Error extends Error {
|
|
44
|
+
packageSpecs: readonly ParsedPackageSpec[];
|
|
45
|
+
kind: string;
|
|
46
|
+
constructor(packageSpecs: readonly ParsedPackageSpec[]);
|
|
47
|
+
}
|
|
48
|
+
declare function createPackageFromTarballUrl(tarballUrl: string): Promise<Package>;
|
|
49
|
+
declare function createPackageFromTarballData(tarball: Uint8Array): Package;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/checkPackage.d.ts
|
|
52
|
+
interface CheckPackageOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Exhaustive list of entrypoints to check. The package root is `"."`.
|
|
55
|
+
* Specifying this option disables automatic entrypoint discovery,
|
|
56
|
+
* and overrides the `includeEntrypoints` and `excludeEntrypoints` options.
|
|
57
|
+
*/
|
|
58
|
+
entrypoints?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Entrypoints to check in addition to automatically discovered ones.
|
|
61
|
+
*/
|
|
62
|
+
includeEntrypoints?: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Entrypoints to exclude from checking.
|
|
65
|
+
*/
|
|
66
|
+
excludeEntrypoints?: (string | RegExp)[];
|
|
67
|
+
/**
|
|
68
|
+
* Whether to automatically consider all published files as entrypoints
|
|
69
|
+
* in the absence of any other detected or configured entrypoints.
|
|
70
|
+
*/
|
|
71
|
+
entrypointsLegacy?: boolean;
|
|
72
|
+
}
|
|
73
|
+
declare function checkPackage(pkg: Package, options?: CheckPackageOptions): Promise<CheckResult>;
|
|
74
|
+
//#endregion
|
|
75
|
+
export { type Analysis, type AnalysisTypes, type BuildTool, type CJSOnlyExportsDefaultProblem, type CJSResolvesToESMProblem, CheckPackageOptions, type CheckResult, CreatePackageFromNpmOptions, type EntrypointInfo, type EntrypointResolutionAnalysis, type EntrypointResolutionProblem, type Failable, type FallbackConditionProblem, type FalseCJSProblem, type FalseESMProblem, type FalseExportDefaultProblem, type FilePairProblem, type FileTextRangeProblem, type IncludedTypes, type InternalResolutionErrorProblem, type MissingExportEqualsProblem, type ModuleKind, type ModuleKindPairProblem, type ModuleKindReason, type NamedExportsProblem, type NoResolutionProblem, Npm404Error, Package, type ParsedPackageSpec, type Problem, type ProblemKind, type ProgramInfo, type Resolution, type ResolutionKind, type ResolutionOption, ResolvedPackageId, type TypesPackage, type UnexpectedModuleSyntaxProblem, type UntypedResolutionProblem, type UntypedResult, checkPackage, createPackageFromNpm, createPackageFromTarballData, createPackageFromTarballUrl, resolveImplementationPackageForTypesPackage, resolveTypesPackageForPackage };
|