-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtsconfig.examples.json
More file actions
55 lines (55 loc) · 3.29 KB
/
Copy pathtsconfig.examples.json
File metadata and controls
55 lines (55 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// The EXAMPLES-layer type-check program for @objectstack/plugin-auth (#10869),
// WIDENED (#14386) to also carry this package's manifest authoring site.
//
// `packages/plugins/plugin-auth/examples/` held `basic-usage.ts` -- the file
// `content/docs/permissions/authentication.mdx` publishes as "Basic Auth
// Example" -- and no tsc program had ever read a line of it. `tsconfig.json`
// selects `src/**/*`, tsup builds only `src`, and nothing imports it, so it was
// the source census's single instance of a file in NO tsc program at all. What
// that hid: line 12 imports `@objectstack/plugin-hono-server`, which this
// package declared in none of its dependency blocks, so the published example
// could not resolve, compile or run for anyone who copied it.
//
// A SIBLING rather than a wider `include` on `tsconfig.json`, the distinction
// #5475 drew for `packages/spec` and #10756 for `packages/objectql/scripts`,
// and it holds here for the same reason: that config EMITS (`rootDir: "src"`,
// `outDir: "dist"`), so widening it to reach `examples/` would put the
// directory in front of the emit and `rootDir` would reject it -- and `tsup`
// would start shipping the example. This program emits nothing, so it can
// neutralise `rootDir` without touching what ships.
//
// #14386 ADDED `objectstack.config.ts` (the package-ROOT manifest, `defineStack`
// composing `./src/manifest`) to `include` below, joining `examples/**/*` in
// this same sibling rather than opening a second one: it is a package-root file
// for the identical reason `examples/` is -- `tsconfig.json`'s `include` is
// `src/**/*`, which cannot match a root-level file either -- and this sibling
// already neutralises `rootDir` to `.` for exactly that reason. Before this
// change no tsc program read the manifest: `check:type-check-coverage`'s
// `isUncheckedSourceCandidate` skips `depth === 0` by construction (the
// package-root line), so `pnpm --filter @objectstack/plugin-auth typecheck`
// exiting 0 carried no information about it, of the same shape #13284 found
// and fixed in `packages/drivers/driver-memory` and `packages/plugins/
// plugin-hono-server`. See `scripts/check-type-check-coverage.mjs`'s
// `ROOT_SOURCE_FILES` for the declared allowlist this repairs against.
//
// STRICTNESS IS INHERITED and deliberately not relaxed: `strict`,
// `noUnusedLocals`, `noUnusedParameters`, `noImplicitReturns` and the rest come
// from the root config through `tsconfig.json`. The directory type-checks clean
// under them -- it enters with ZERO recorded debt, and there is no ledger here
// to record any in. A published example that does not compile is the finding,
// not a line to write down.
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
// `../..` (= `packages/`) rather than the inherited value, because the
// files this program checks (`examples/**/*`, `objectstack.config.ts`) sit
// outside `src`, and #14762's `paths` rule on the parent config pulls
// `packages/services/service-messaging/src/**` into the program too --
// `rootDir` is enforced over every program file even under `--noEmit`, so
// it has to be the directory containing both. Safe precisely because
// nothing is emitted from here -- see the header.
"rootDir": "../.."
},
"include": ["examples/**/*", "objectstack.config.ts"]
}