carveout 0.1.0 → 0.1.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/AGENTS.md +21 -3
- package/NOTICE.md +2 -1
- package/README.md +274 -460
- package/dist/src/account.d.ts +37 -0
- package/dist/src/account.js +275 -0
- package/dist/src/api.d.ts +148 -0
- package/dist/src/api.js +120 -0
- package/dist/src/carve.d.ts +788 -0
- package/dist/src/carve.js +1721 -125
- package/dist/src/cli.d.ts +10 -0
- package/dist/src/cli.js +674 -47
- package/dist/src/command.d.ts +10 -0
- package/dist/src/core.d.ts +11 -0
- package/dist/src/cut.d.ts +78 -0
- package/dist/src/cut.js +25 -7
- package/dist/src/extract/compiler-config.d.ts +49 -0
- package/dist/src/extract/fixture.d.ts +103 -0
- package/dist/src/extract/hash.d.ts +6 -0
- package/dist/src/extract/package-registry.d.ts +47 -0
- package/dist/src/extract/package-types.d.ts +52 -0
- package/dist/src/extract/surface.d.ts +44 -0
- package/dist/src/extract/typescript.d.ts +180 -0
- package/dist/src/gate.d.ts +55 -0
- package/dist/src/gate.js +1 -0
- package/dist/src/graph.d.ts +142 -0
- package/dist/src/graph.js +4 -3
- package/dist/src/impact.d.ts +113 -0
- package/dist/src/imports.d.ts +67 -0
- package/dist/src/mergeback.d.ts +182 -0
- package/dist/src/mergeback.js +580 -35
- package/dist/src/platform.d.ts +69 -0
- package/dist/src/platform.js +184 -0
- package/dist/src/policy.d.ts +181 -0
- package/dist/src/policy.js +716 -230
- package/dist/src/project/build.d.ts +23 -0
- package/dist/src/project/catalog.d.ts +25 -0
- package/dist/src/project/project.d.ts +287 -0
- package/dist/src/project/project.js +479 -52
- package/dist/src/project/provenance.d.ts +73 -0
- package/dist/src/project/provenance.js +12 -0
- package/dist/src/project/runner.d.ts +19 -0
- package/dist/src/project/secrets.d.ts +64 -0
- package/dist/src/project/vitest-config.d.ts +70 -0
- package/dist/src/project/vitest-config.js +291 -0
- package/dist/src/pseudonyms/aliases.d.ts +107 -0
- package/dist/src/pseudonyms/aliases.js +394 -0
- package/dist/src/pseudonyms/draft.d.ts +64 -0
- package/dist/src/pseudonyms/draft.js +284 -0
- package/dist/src/pseudonyms/folder.d.ts +172 -0
- package/dist/src/pseudonyms/folder.js +527 -0
- package/dist/src/pseudonyms/index.d.ts +11 -0
- package/dist/src/pseudonyms/index.js +11 -0
- package/dist/src/pseudonyms/vocabulary.d.ts +113 -0
- package/dist/src/pseudonyms/vocabulary.js +522 -0
- package/dist/src/readiness.d.ts +71 -0
- package/dist/src/readiness.js +131 -0
- package/dist/src/receipt.d.ts +154 -0
- package/dist/src/receipt.js +296 -0
- package/dist/src/sandbox.d.ts +53 -0
- package/dist/src/sandbox.js +154 -0
- package/dist/src/slice/analysis.d.ts +75 -0
- package/dist/src/slice/externals.d.ts +51 -0
- package/dist/src/slice/graph.d.ts +69 -0
- package/dist/src/slice/manifest.d.ts +262 -0
- package/dist/src/slice/manifest.js +4 -3
- package/dist/src/slice/reach.d.ts +204 -0
- package/dist/src/slice/reach.js +11 -5
- package/dist/src/slice/report.d.ts +49 -0
- package/dist/src/slice/report.js +5 -2
- package/dist/src/specifiers.d.ts +48 -0
- package/dist/src/status.d.ts +46 -0
- package/dist/src/status.js +3 -2
- package/dist/src/test-integrity.d.ts +54 -0
- package/dist/src/test-integrity.js +812 -0
- package/package.json +24 -5
- package/skills/carveout/SKILL.md +517 -0
- package/skills/carveout-gate/SKILL.md +98 -0
- package/SKILL.md +0 -423
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The local toolchain every carved-out project declares. Fixed per tool
|
|
3
|
+
* version so two cuts of one slice are byte-identical.
|
|
4
|
+
*/
|
|
5
|
+
export interface Toolchain {
|
|
6
|
+
/** `.nvmrc` content. */
|
|
7
|
+
readonly node: string;
|
|
8
|
+
/** `engines.node`. */
|
|
9
|
+
readonly nodeRange: string;
|
|
10
|
+
readonly npm: string;
|
|
11
|
+
readonly typescript: string;
|
|
12
|
+
readonly testRunner: "node:test";
|
|
13
|
+
readonly supportedPlatforms: readonly ("darwin" | "linux" | "win32")[];
|
|
14
|
+
}
|
|
15
|
+
export declare const SANDBOX_TOOLCHAIN: Toolchain;
|
|
16
|
+
/** The commands a contributor runs, with or without the extension. */
|
|
17
|
+
export declare const SANDBOX_COMMANDS: {
|
|
18
|
+
readonly install: "npm ci";
|
|
19
|
+
readonly dev: "npm run dev";
|
|
20
|
+
readonly build: "npm run build";
|
|
21
|
+
readonly test: "npm test";
|
|
22
|
+
};
|
|
23
|
+
export type SandboxCommand = keyof typeof SANDBOX_COMMANDS;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version catalogs: a pin of `catalog:` or `catalog:<name>` names a version
|
|
3
|
+
* the workspace defines once, in pnpm's `pnpm-workspace.yaml` (`catalog:`
|
|
4
|
+
* and `catalogs:`) or in the root `package.json` (Bun's and pnpm's
|
|
5
|
+
* `workspaces.catalog(s)`, or top-level `catalog(s)`). npm knows no such
|
|
6
|
+
* protocol, so a slice's `package.json` takes the version the catalog
|
|
7
|
+
* gives, and its lockfile resolves (E8g: n8n's `catalog:typescript` stopped
|
|
8
|
+
* the install).
|
|
9
|
+
*/
|
|
10
|
+
type Catalogs = Map<string, Map<string, string>>;
|
|
11
|
+
/**
|
|
12
|
+
* The `catalog:` and `catalogs:` maps of a `pnpm-workspace.yaml`: the
|
|
13
|
+
* block-style YAML pnpm writes, read line by line by indentation. Flow
|
|
14
|
+
* maps and anchors are not read; a catalog written so resolves nothing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseWorkspaceCatalogs(text: string): Catalogs;
|
|
17
|
+
/** The repository's catalogs, from every place a package manager keeps one. */
|
|
18
|
+
export declare function workspaceCatalogs(repo: string): Catalogs;
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a pin through the catalogs: `catalog:` is the default catalog,
|
|
21
|
+
* `catalog:<name>` a named one. Any other pin, and a catalog entry that is
|
|
22
|
+
* not there, comes back as given (and a non-registry pin stays a blocker).
|
|
23
|
+
*/
|
|
24
|
+
export declare function catalogResolver(repo: string): (name: string, version: string) => string;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standalone project a cut becomes, as a pure function of the slice,
|
|
3
|
+
* the copied source and the dependency resolution.
|
|
4
|
+
*
|
|
5
|
+
* Copied source keeps its repository structure. Everything generated lives
|
|
6
|
+
* apart from it under `carveout/` and is classified: declaration stubs
|
|
7
|
+
* beside runtime mocks for the modules the slice imports from outside,
|
|
8
|
+
* mock packages for the packages it does not install, the recording mock
|
|
9
|
+
* runtime and the ambient declarations the slice compiled against, an
|
|
10
|
+
* interface test for the surface outside code imports, and the
|
|
11
|
+
* configuration that makes `npm ci`, `npm run dev`, `npm run build` and
|
|
12
|
+
* `npm test` work on a clean machine with no credentials.
|
|
13
|
+
*
|
|
14
|
+
* An import the source makes through a compiler alias is rewritten to a
|
|
15
|
+
* relative path and recorded, so `carveout patch` can undo it; a bare
|
|
16
|
+
* specifier that neither a package nor a cut module explains is a blocker,
|
|
17
|
+
* never a guess. Bodies of copied source are never rewritten beyond those
|
|
18
|
+
* specifiers.
|
|
19
|
+
*/
|
|
20
|
+
import { type VitestSettings } from "./vitest-config.js";
|
|
21
|
+
import type { BoundaryContract, BoundarySymbol, SliceManifest } from "../slice/manifest.js";
|
|
22
|
+
import { type Toolchain } from "./build.js";
|
|
23
|
+
import { type PathClass, type ResolvedDependency } from "./provenance.js";
|
|
24
|
+
export declare const HARNESS_DIR = "carveout";
|
|
25
|
+
export declare const MOCKS_DIR = "carveout/packages";
|
|
26
|
+
/** Mocks of modules that are no package (`virtual:build-info`), with the loader's map of them. */
|
|
27
|
+
export declare const VIRTUAL_DIR = "carveout/virtual";
|
|
28
|
+
export declare const VIRTUAL_MAP_PATH = "carveout/virtual/map.json";
|
|
29
|
+
export declare const TESTS_DIR = "carveout/tests";
|
|
30
|
+
export declare const MOCK_RUNTIME_PATH = "carveout/mock.js";
|
|
31
|
+
export declare const AMBIENT_PATH = "carveout/ambient.d.ts";
|
|
32
|
+
export declare const RUN_PATH = "carveout/run.ts";
|
|
33
|
+
export declare const TEST_RUNNER_PATH = "carveout/test.js";
|
|
34
|
+
/** The public surface's declarations and their type check (`extract/surface.ts`). */
|
|
35
|
+
export declare const SURFACE_DIR = "carveout/surface";
|
|
36
|
+
export declare const SURFACE_CHECK_PATH = "carveout/surface/check.ts";
|
|
37
|
+
export declare const SURFACE_CONFIG_PATH = "carveout/surface/tsconfig.json";
|
|
38
|
+
/**
|
|
39
|
+
* The last test run, as TAP: node:test's, then a `not ok` line for each
|
|
40
|
+
* failing Vitest test and surface check, then `# carveout` lines with each
|
|
41
|
+
* runner's counts. What `check` reads the baseline and the counts from.
|
|
42
|
+
*/
|
|
43
|
+
export declare const LAST_RUN_PATH = "carveout/.last-run.tap";
|
|
44
|
+
/**
|
|
45
|
+
* Folders a contributor's tools write at a folder's root: npm's cache kept
|
|
46
|
+
* in the folder (`npm ci --cache .npm-cache`), a coverage report, a build
|
|
47
|
+
* tool's cache. None is part of a change: a patch leaves them out, and
|
|
48
|
+
* nothing in them is built or run.
|
|
49
|
+
*/
|
|
50
|
+
export declare const TOOL_DIRS: readonly string[];
|
|
51
|
+
/** The last run's counts, by runner, written by the runner after every test ran. */
|
|
52
|
+
export declare const COUNTS_PATH = "carveout/.last-run.json";
|
|
53
|
+
/** The last Vitest run's JSON report, which the runner reads into the TAP. */
|
|
54
|
+
export declare const VITEST_REPORT_PATH = "carveout/.vitest.json";
|
|
55
|
+
/** The tests that failed when the folder was first checked: they fail on the mocks. */
|
|
56
|
+
export declare const BASELINE_PATH = "carveout/baseline.json";
|
|
57
|
+
export declare const ENV_FILE = "carveout.env";
|
|
58
|
+
export declare const ASSETS_LOADER_PATH = "carveout/assets.js";
|
|
59
|
+
/**
|
|
60
|
+
* Files a script imports that are not code: copied with the slice, typed
|
|
61
|
+
* as untyped modules, and loaded at runtime as their own path.
|
|
62
|
+
*/
|
|
63
|
+
export declare const ASSET_EXTENSIONS: readonly string[];
|
|
64
|
+
export declare function isAssetPath(path: string): boolean;
|
|
65
|
+
/** Where a cut came from, as the README and package name say it. */
|
|
66
|
+
export interface ProjectOrigin {
|
|
67
|
+
/** The repository folder's name; null for a public folder. */
|
|
68
|
+
readonly repository: string | null;
|
|
69
|
+
/** The project's package name. */
|
|
70
|
+
readonly name: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ProjectSource {
|
|
73
|
+
/** The repository path. */
|
|
74
|
+
readonly originalPath: string;
|
|
75
|
+
/** The path in the project; the same as the repository's. */
|
|
76
|
+
readonly path: string;
|
|
77
|
+
readonly text: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ProjectStub {
|
|
80
|
+
/** The cut module's repository path. */
|
|
81
|
+
readonly module: string;
|
|
82
|
+
/** The module's path in the project, with its source extension. */
|
|
83
|
+
readonly path: string;
|
|
84
|
+
/** The declaration stub's text. */
|
|
85
|
+
readonly text: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ProjectInput {
|
|
88
|
+
readonly origin: ProjectOrigin;
|
|
89
|
+
readonly manifest: SliceManifest;
|
|
90
|
+
readonly contract: BoundaryContract;
|
|
91
|
+
readonly sources: readonly ProjectSource[];
|
|
92
|
+
readonly stubs: readonly ProjectStub[];
|
|
93
|
+
readonly dependencies: readonly ResolvedDependency[];
|
|
94
|
+
/** Bare specifiers that need no rewrite: Node's modules and packages. */
|
|
95
|
+
readonly knownSpecifiers: readonly string[];
|
|
96
|
+
/** A safe subset of the source's compiler options, if they were read. */
|
|
97
|
+
readonly compilerOptions?: Readonly<Record<string, unknown>>;
|
|
98
|
+
/** What the sources read of each package, declared as the slice's check declared it. */
|
|
99
|
+
readonly packageModules?: PackageModules;
|
|
100
|
+
readonly toolchain?: Toolchain;
|
|
101
|
+
/** The coverage the repository's package test holds its sources to. */
|
|
102
|
+
readonly coverage?: CoverageGate;
|
|
103
|
+
/** Keep the source's noImplicitAny: the slice compiled under it. */
|
|
104
|
+
readonly keepsImplicitAny?: boolean;
|
|
105
|
+
/** Where the stubs leave an implicit any; see `SliceAnalysis.implicitAnyFiles`. */
|
|
106
|
+
readonly implicitAnyFiles?: readonly string[];
|
|
107
|
+
/** The package's Vitest settings, for the folder's `vitest.config.mjs`; see `vitest-config.ts`. */
|
|
108
|
+
readonly vitest?: VitestSettings;
|
|
109
|
+
/** The runner the package's own tests run on, when it is Vitest: the folder is set up for it with no test of it carried. */
|
|
110
|
+
readonly testRunner?: "vitest";
|
|
111
|
+
/** The folder installs Node's own types instead of the fallback globals. */
|
|
112
|
+
readonly hasNodeTypes?: boolean;
|
|
113
|
+
/** Service packages kept real rather than mocked, sorted. */
|
|
114
|
+
readonly live?: readonly string[];
|
|
115
|
+
/**
|
|
116
|
+
* Of the environment the slice reads, the names the live packages'
|
|
117
|
+
* importers read: left out of `carveout.env`, so the shell's values or
|
|
118
|
+
* the code's own defaults apply.
|
|
119
|
+
*/
|
|
120
|
+
readonly liveEnvironment?: readonly string[];
|
|
121
|
+
/** The public surface's declarations and type check, `carveout/surface/`. */
|
|
122
|
+
readonly surface?: readonly {
|
|
123
|
+
path: string;
|
|
124
|
+
text: string;
|
|
125
|
+
}[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Coverage thresholds a package's `node --test` script sets, in percent,
|
|
129
|
+
* over the sources under `folder` (a package's root, "" for the root).
|
|
130
|
+
*/
|
|
131
|
+
export interface CoverageGate {
|
|
132
|
+
readonly folder: string;
|
|
133
|
+
readonly lines?: number;
|
|
134
|
+
readonly branches?: number;
|
|
135
|
+
readonly functions?: number;
|
|
136
|
+
/**
|
|
137
|
+
* The test sources the package's script runs, relative to `folder`
|
|
138
|
+
* (`test/*.test.ts` for `--test dist-test/test/*.test.js`): a test
|
|
139
|
+
* elsewhere never runs in the repository, and never covers anything.
|
|
140
|
+
*/
|
|
141
|
+
readonly tests?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The script also fails when a compiled source under `dir` (relative to
|
|
144
|
+
* `folder`, back at the sources) was loaded by no test, except the files
|
|
145
|
+
* named: `assert-all-covered <dir> <report> [exclude...]`.
|
|
146
|
+
*/
|
|
147
|
+
readonly allCovered?: {
|
|
148
|
+
readonly dir: string;
|
|
149
|
+
readonly excluded: readonly string[];
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The test sources a package's test script runs, relative to its folder,
|
|
154
|
+
* when it names them (`--test dist-test/test/*.test.js`, back at the
|
|
155
|
+
* sources: `test/*.test.ts`); undefined when it leaves them to the
|
|
156
|
+
* runner's defaults, which find a test anywhere.
|
|
157
|
+
*/
|
|
158
|
+
export declare function testsGlobOf(script: string): string | undefined;
|
|
159
|
+
/** The thresholds a package's test script passes to `node --test`, if any. */
|
|
160
|
+
export declare function coverageGateOf(folder: string, script: string): CoverageGate | null;
|
|
161
|
+
export interface GeneratedFile {
|
|
162
|
+
readonly path: string;
|
|
163
|
+
readonly text: string;
|
|
164
|
+
readonly class: PathClass;
|
|
165
|
+
readonly public: boolean;
|
|
166
|
+
}
|
|
167
|
+
export interface ImportRewrite {
|
|
168
|
+
readonly file: string;
|
|
169
|
+
readonly from: string;
|
|
170
|
+
readonly to: string;
|
|
171
|
+
}
|
|
172
|
+
export interface ProjectBlocker {
|
|
173
|
+
readonly code: "import_unrewritable" | "language_unsupported" | "mock_unsupported" | "path_conflict" | "secret_found" | "test_runner_mocked" | "vocabulary_leaked";
|
|
174
|
+
readonly file: string | null;
|
|
175
|
+
readonly detail: string;
|
|
176
|
+
}
|
|
177
|
+
export interface GeneratedProject {
|
|
178
|
+
readonly files: readonly GeneratedFile[];
|
|
179
|
+
readonly importRewrites: readonly ImportRewrite[];
|
|
180
|
+
readonly tests: readonly string[];
|
|
181
|
+
readonly blockers: readonly ProjectBlocker[];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The runtime shape of a symbol. The extractor names most kinds; a
|
|
185
|
+
* re-export it could only follow by name arrives as `unknown`, and its
|
|
186
|
+
* declaration text says whether it is a type (`export type { X }`,
|
|
187
|
+
* `interface`, `type`) or a value. A symbol with neither a kind nor a
|
|
188
|
+
* declaration cannot be mocked.
|
|
189
|
+
*/
|
|
190
|
+
export declare function runtimeKindOf(symbol: BoundarySymbol): "value" | "type" | "enum" | "unknown";
|
|
191
|
+
/**
|
|
192
|
+
* Whether `runtimeKindOf` read a symbol's kind off the import it is
|
|
193
|
+
* exported again from, which says nothing of what it is: a mock may export
|
|
194
|
+
* it (harmless for a type), a test must not assert it.
|
|
195
|
+
*/
|
|
196
|
+
export declare function guessedFromImport(symbol: BoundarySymbol): boolean;
|
|
197
|
+
export declare function dirnameOf(path: string): string;
|
|
198
|
+
/** `../lib/service.js` from `src/app.ts` to `lib/service.ts`. */
|
|
199
|
+
export declare function relativeSpecifier(fromFile: string, toFile: string): string;
|
|
200
|
+
/** The emitted JavaScript path of a TypeScript source path. */
|
|
201
|
+
export declare function runtimePath(path: string): string;
|
|
202
|
+
/** What `npm run dev` and `npm test` run once the project is built. */
|
|
203
|
+
export declare const SANDBOX_RUN_ARGV: {
|
|
204
|
+
readonly dev: readonly ["node", "--env-file=carveout.env", "--import=./carveout/assets.js", string];
|
|
205
|
+
readonly test: readonly ["node", "--env-file=carveout.env", "--import=./carveout/assets.js", "--test", "carveout/tests/**/*.test.js"];
|
|
206
|
+
};
|
|
207
|
+
/** A carved-out project's `package.json` scripts. */
|
|
208
|
+
export declare const SANDBOX_SCRIPTS: {
|
|
209
|
+
readonly build: "tsc -p tsconfig.json";
|
|
210
|
+
readonly dev: `npm run build && ${string}`;
|
|
211
|
+
readonly test: `npm run build && ${string}`;
|
|
212
|
+
};
|
|
213
|
+
/** `x.ts`, `x.tsx` and `x.js` → `x.d.ts`; `x.mts` → `x.d.mts`; `x.cts` → `x.d.cts`. */
|
|
214
|
+
export declare function declarationPath(path: string): string;
|
|
215
|
+
/** A TypeScript source the project compiles, as opposed to a declaration or an asset. */
|
|
216
|
+
export declare function isScript(path: string): boolean;
|
|
217
|
+
/** Members of a `declare enum` declaration, as `[name, value]` pairs. */
|
|
218
|
+
export declare function enumMembers(declaration: string): {
|
|
219
|
+
name: string;
|
|
220
|
+
value: string | number;
|
|
221
|
+
}[] | null;
|
|
222
|
+
export declare const MOCK_RUNTIME_TYPES = "export interface RecordedCall {\n readonly name: string;\n readonly args: readonly unknown[];\n}\nexport function recordedCalls(): RecordedCall[];\nexport function resetMocks(): void;\nexport function mockImplementation(\n path: string,\n implementation: (...args: unknown[]) => unknown,\n): void;\nexport function fixture(\n path: string,\n implementation: (...args: any[]) => unknown,\n): void;\nexport function createMock(origin: string, name?: string): any;\n";
|
|
223
|
+
/**
|
|
224
|
+
* Module declarations for the specifiers a slice reads names of, each
|
|
225
|
+
* exporting those names as values and types, as the worker writes them for
|
|
226
|
+
* the slice's own check. They take the place of the specifier's untyped
|
|
227
|
+
* shorthand, which only works as a value: `import type { X }` from it fails.
|
|
228
|
+
* An installed package's are patterns (`"zod*"`), so its own types win.
|
|
229
|
+
*/
|
|
230
|
+
export interface PackageModules {
|
|
231
|
+
readonly specifiers: readonly string[];
|
|
232
|
+
readonly text: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Node's own modules and globals, untyped: what `@types/node` gives code
|
|
236
|
+
* the ES libraries alone do not. The slice is type-checked against these
|
|
237
|
+
* and a generated project builds against them. Where the DOM library
|
|
238
|
+
* declares a global too, the library's declaration comes first and keeps
|
|
239
|
+
* its type; the clash is in a declaration file, which `skipLibCheck`
|
|
240
|
+
* leaves unchecked.
|
|
241
|
+
*/
|
|
242
|
+
export declare const NODE_GLOBAL_DECLARATIONS: readonly string[];
|
|
243
|
+
export declare function ambientDeclarations(packages: readonly string[], modules?: PackageModules, installed?: ReadonlySet<string>, hasNodeTypes?: boolean): string;
|
|
244
|
+
/**
|
|
245
|
+
* The compiler options a generated project builds with: the source's safe
|
|
246
|
+
* options carried over, the source's bundler resolution when it uses one,
|
|
247
|
+
* otherwise Node's ESM resolution, and no emitted declarations.
|
|
248
|
+
*/
|
|
249
|
+
export declare function projectCompilerOptions(options: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
|
|
250
|
+
/** `tsconfig.json` for a generated project. */
|
|
251
|
+
export declare function tsconfigFor(options: Readonly<Record<string, unknown>> | undefined, types?: readonly string[], excluded?: readonly string[],
|
|
252
|
+
/** Module names TypeScript finds by path: the folder's virtual modules. */
|
|
253
|
+
paths?: Readonly<Record<string, readonly string[]>>): string;
|
|
254
|
+
/** The folder's build when the stubs leave implicit anys: tsc, with those not counted. */
|
|
255
|
+
export declare const BUILD_SCRIPT_PATH = "carveout/build.js";
|
|
256
|
+
/**
|
|
257
|
+
* `carveout/build.js`: runs the folder's tsc, holding the code to the
|
|
258
|
+
* repository's noImplicitAny but for the files where the cut found the
|
|
259
|
+
* stubs leave an implicit any (a callback passed to a mocked package has
|
|
260
|
+
* no parameter types to take): those errors are the stubs', and are not
|
|
261
|
+
* counted. Any other error, an implicit any elsewhere included, fails it.
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* The implicit-any diagnostics, by code: TypeScript's 7xxx family but its
|
|
265
|
+
* other checks there (TS7027 unreachable code, TS7028 an unused label,
|
|
266
|
+
* TS7029 a switch case that falls through, TS7030 a path that returns
|
|
267
|
+
* nothing), which hold the code to the repository's rules and are never
|
|
268
|
+
* the stubs' doing. The source of a regular expression over the digits.
|
|
269
|
+
*/
|
|
270
|
+
export declare const IMPLICIT_ANY_CODE = "7(?!02[7-9]|030)\\d{3}";
|
|
271
|
+
export declare function buildScript(waived: readonly string[]): string;
|
|
272
|
+
export declare function scanNamedImports(sources: readonly ProjectSource[]): Map<string, Set<string>>;
|
|
273
|
+
/**
|
|
274
|
+
* `npm test`: every test in the folder at the time it runs, so a test added
|
|
275
|
+
* after the cut runs too. Each goes to the runner it imports; Node runs the
|
|
276
|
+
* compiled `.js`, Vitest the source.
|
|
277
|
+
*/
|
|
278
|
+
export declare function testRunnerScript(coverage: CoverageGate | undefined, globals?: boolean, waived?: readonly string[],
|
|
279
|
+
/** The test files the package's Vitest runs (its config's include), as globs from the folder's root. */
|
|
280
|
+
vitestInclude?: readonly string[],
|
|
281
|
+
/** The runner the package's own tests run on, when it is Vitest: a node:test file added runs nowhere there. */
|
|
282
|
+
packageRunner?: "vitest"): string;
|
|
283
|
+
/**
|
|
284
|
+
* Generates the project. Deterministic: the same inputs give the same
|
|
285
|
+
* files in the same order.
|
|
286
|
+
*/
|
|
287
|
+
export declare function generateProject(input: ProjectInput): GeneratedProject;
|