@codefast/typescript-config 0.9.0 → 0.10.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 +55 -0
- package/LICENSE +1 -1
- package/README.md +41 -15
- package/base.json +2 -2
- package/library-build.json +1 -1
- package/library.json +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @codefast/typescript-config
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#976](https://github.com/codefastlabs/codefast/pull/976) `engines.node` is now `>=24.0.0`, up from `>=22.12.0`, and Node 22 is no longer supported. Node 24.0.0 is the first
|
|
8
|
+
release with explicit resource management built in (`using`, `await using`, `DisposableStack`, `AsyncDisposableStack`,
|
|
9
|
+
`SuppressedError`) and all of ES2025, so the packages use both as the platform ships them instead of shimming them for
|
|
10
|
+
an older line, and the CI matrix runs the unit suite on 24.0.0 itself. Move to Node 24, or stay on the current minor
|
|
11
|
+
while a deployment still runs Node 22.
|
|
12
|
+
|
|
13
|
+
- [#976](https://github.com/codefastlabs/codefast/pull/976) The presets' `lib` and `target` move from `ES2024` to `ES2025`, the newest edition that Node 24 and the supported
|
|
14
|
+
browsers both ship. `base.json`, and so `react.json` and `next.json`, lists `DOM`, `DOM.Iterable` and `ES2025`;
|
|
15
|
+
`library.json` lists `ES2025`. A program on a preset can use ES2025 builtins with no `lib` entry of its own, and a
|
|
16
|
+
builtin newer than that, such as `Map.prototype.getOrInsert`, is still a type error.
|
|
17
|
+
|
|
18
|
+
- [#965](https://github.com/codefastlabs/codefast/pull/965) The `typescript` peer range is now `>=7.0.0`, up from `>=5.0.0`: TypeScript 7 is the one compiler the presets are
|
|
19
|
+
checked against, so it is the floor they support. A project pinned to TypeScript 6 or older now fails npm's peer
|
|
20
|
+
resolution (`ERESOLVE`) and gets a pnpm peer warning. Move it to TypeScript 7, or stay on 0.9.x while its tooling still
|
|
21
|
+
needs TypeScript 6. A Next.js app on `next.json` needs Next.js 16.3 or later, the first release that type-checks with
|
|
22
|
+
TypeScript 7.
|
|
23
|
+
|
|
24
|
+
- [#977](https://github.com/codefastlabs/codefast/pull/977) `library-build.json` sets `types: []` instead of `["node"]`, so a build loads only the ambient types its own config
|
|
25
|
+
names. A package that runs on Node adds `types: ["node"]` to its `tsconfig.build.json`, which also brings explicit
|
|
26
|
+
resource management. A browser or universal package leaves it empty, so a Node global in its source fails the build. No
|
|
27
|
+
preset lists `ESNext.Disposable`: a Node program gets explicit resource management from `@types/node` 24 or later, and a
|
|
28
|
+
browser program adds it once the browsers it targets ship it, which Safari has not.
|
|
29
|
+
|
|
30
|
+
## 0.9.1
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#892](https://github.com/codefastlabs/codefast/pull/892) [`4c97c5b`](https://github.com/codefastlabs/codefast/commit/4c97c5b8c2314f25ee9df7eac5a4b5dd723d6d90) Thanks [@thevuong](https://github.com/thevuong)! - Lower the monorepo's Node floor from 24 to 22.12, so the packages install and run on the active Node 22 LTS line.
|
|
35
|
+
|
|
36
|
+
`engines.node` becomes `>=22.12.0` across every package — the floor the shared toolchain (oxlint, Vite, Vitest, TanStack
|
|
37
|
+
Start) already requires. Development stays on the latest Node (`.node-version`) for speed, and a CI matrix exercises the
|
|
38
|
+
floor and the active LTS directly, so the floor is a contract CI proves rather than one everyone has to run.
|
|
39
|
+
`@types/node` is pinned to the floor's major (`^22`), with a workspace override holding the whole tree there so a dev
|
|
40
|
+
tool's `@types/node: "*"` peer can no longer pull a newer major and mask an API the floor lacks. The floor stays
|
|
41
|
+
mechanical, not advisory: `@codefast/di` keeps its own `Map` upsert helpers rather than the ES2025
|
|
42
|
+
`Map.prototype.getOrInsert` (which would raise the floor to 26) and its `lib` stays `ES2024`. `@codefast/cli`'s mirror
|
|
43
|
+
step now calls the `node:path` functions directly instead of aliasing them, which the floor's types correctly flag as
|
|
44
|
+
unbound methods.
|
|
45
|
+
|
|
46
|
+
The shared `@codefast/typescript-config` presets pin `lib` and `target` to `ES2024` (was `ESNext`) so the compiler's
|
|
47
|
+
ECMAScript surface matches the Node floor: an ES2025 builtin such as `Map.prototype.getOrInsert` now fails to type-check
|
|
48
|
+
rather than compiling and crashing on Node 22.12. `@codefast/di` and `@codefast/di-testing` already pinned `lib` and are
|
|
49
|
+
unchanged.
|
|
50
|
+
|
|
51
|
+
Internal subpath imports move from a `#/` prefix to a bare `#` (`#core/token`, not `#/core/token`), and the
|
|
52
|
+
`package.json#imports` keys become `#*`/`#tests/*`/`#examples/*` to match. Node's native ESM resolver rejects a
|
|
53
|
+
`#/`-prefixed specifier with `ERR_INVALID_MODULE_SPECIFIER` on the whole Node 22 line (and on Node 24 before 24.14), and
|
|
54
|
+
each package ships those specifiers verbatim inside its published `dist/*.js` for a consumer's Node to resolve — so this
|
|
55
|
+
rename is what actually lets the packages import on the new floor. Purely internal: a consumer's own import paths are
|
|
56
|
+
unchanged.
|
|
57
|
+
|
|
3
58
|
## 0.9.0
|
|
4
59
|
|
|
5
60
|
### Minor Changes
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -15,8 +15,14 @@ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothin
|
|
|
15
15
|
|
|
16
16
|
- **Strict by default.** `strict`, `noUncheckedIndexedAccess`, `noImplicitOverride`, and `verbatimModuleSyntax` come
|
|
17
17
|
from the base that every preset extends.
|
|
18
|
-
- **Bundler-first.** An ESNext
|
|
19
|
-
|
|
18
|
+
- **Bundler-first.** An ESNext `module` with `moduleResolution: "bundler"`, so `exports` and `imports` maps resolve the
|
|
19
|
+
way Vite, esbuild, and friends resolve them.
|
|
20
|
+
- **`lib` and `target` match the runtime floors**: both are `ES2025`, the newest edition that Node 24 and the browser
|
|
21
|
+
floor both ship ([support policy](../../SUPPORT.md)). A builtin newer than that, such as `Map.prototype.getOrInsert`,
|
|
22
|
+
is a type error here rather than a runtime crash on the floor. Move them together only when a floor moves.
|
|
23
|
+
- **Ambient types follow the runtime.** No preset loads `@types/node` or lists `ESNext.Disposable`. A program that runs
|
|
24
|
+
on Node adds `types: ["node"]`, which brings the Node globals and explicit resource management with it. A browser
|
|
25
|
+
program leaves both out: Safari has not shipped explicit resource management yet.
|
|
20
26
|
- **Type-check only.** The presets set `noEmit`; a separate build overlay turns on emit and `.d.ts` generation.
|
|
21
27
|
- **Plain JSON.** No runtime code, nothing to import.
|
|
22
28
|
|
|
@@ -26,9 +32,9 @@ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothin
|
|
|
26
32
|
pnpm add -D @codefast/typescript-config
|
|
27
33
|
```
|
|
28
34
|
|
|
29
|
-
`@codefast/typescript-config` requires Node.js 24 or later, and `typescript`
|
|
30
|
-
|
|
31
|
-
breaking changes ship as minor versions, so pin the minor version when you need stability.
|
|
35
|
+
`@codefast/typescript-config` requires Node.js 24 or later, and `typescript` 7 or later as a peer dependency —
|
|
36
|
+
TypeScript 7 is the one compiler the presets are checked against. The package is published on 0.x and versioned on its
|
|
37
|
+
own track: breaking changes ship as minor versions, so pin the minor version when you need stability.
|
|
32
38
|
|
|
33
39
|
## Quick start
|
|
34
40
|
|
|
@@ -42,30 +48,30 @@ full file names only.
|
|
|
42
48
|
}
|
|
43
49
|
```
|
|
44
50
|
|
|
45
|
-
Options you set locally always win, so
|
|
51
|
+
Options you set locally always win, so adjusting a preset takes one line — here, a package that runs on Node:
|
|
46
52
|
|
|
47
53
|
```json
|
|
48
54
|
{
|
|
49
55
|
"extends": "@codefast/typescript-config/library.json",
|
|
50
56
|
"compilerOptions": {
|
|
51
|
-
"
|
|
57
|
+
"types": ["node"]
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
```
|
|
55
61
|
|
|
56
62
|
## Presets
|
|
57
63
|
|
|
58
|
-
| Preset | Extends | Purpose
|
|
59
|
-
| -------------------- | ----------- |
|
|
60
|
-
| `base.json` | — | Strict, bundler-first baseline:
|
|
61
|
-
| `library.json` | `base.json` | Headless packages: `lib` is `
|
|
62
|
-
| `react.json` | `base.json` | React with the automatic JSX runtime (`jsx: "react-jsx"`) — components need no `React` import.
|
|
63
|
-
| `next.json` | `base.json` | Next.js apps: `jsx: "preserve"`, `incremental` builds, and the `next` TypeScript plugin.
|
|
64
|
-
| `library-build.json` | (overlay) | Build-emit overrides for a build config: `noEmit: false`, `declaration` + `isolatedDeclarations`, declaration and source maps, `types: [
|
|
64
|
+
| Preset | Extends | Purpose |
|
|
65
|
+
| -------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `base.json` | — | Strict, bundler-first baseline: ES2025 target, ESNext module, DOM + ES2025 libs, type-check only. |
|
|
67
|
+
| `library.json` | `base.json` | Headless packages: `lib` is `ES2025` only, so relying on a browser global is a type error. A package that runs on Node adds `types: ["node"]`. |
|
|
68
|
+
| `react.json` | `base.json` | React with the automatic JSX runtime (`jsx: "react-jsx"`) — components need no `React` import. |
|
|
69
|
+
| `next.json` | `base.json` | Next.js apps: `jsx: "preserve"`, `incremental` builds, and the `next` TypeScript plugin. |
|
|
70
|
+
| `library-build.json` | (overlay) | Build-emit overrides for a build config: `noEmit: false`, `declaration` + `isolatedDeclarations`, declaration and source maps, and `types: []`, so test-only ambient types stay out of the build. |
|
|
65
71
|
|
|
66
72
|
### Choosing a preset
|
|
67
73
|
|
|
68
|
-
A publishable package with no browser coupling:
|
|
74
|
+
A publishable package with no browser coupling, which runs wherever JavaScript runs:
|
|
69
75
|
|
|
70
76
|
```json
|
|
71
77
|
{
|
|
@@ -74,6 +80,18 @@ A publishable package with no browser coupling:
|
|
|
74
80
|
}
|
|
75
81
|
```
|
|
76
82
|
|
|
83
|
+
A package or CLI that runs on Node:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"extends": "@codefast/typescript-config/library.json",
|
|
88
|
+
"compilerOptions": {
|
|
89
|
+
"types": ["node"]
|
|
90
|
+
},
|
|
91
|
+
"include": ["src"]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
77
95
|
A React app or component library:
|
|
78
96
|
|
|
79
97
|
```json
|
|
@@ -92,6 +110,10 @@ A Next.js app:
|
|
|
92
110
|
}
|
|
93
111
|
```
|
|
94
112
|
|
|
113
|
+
Next.js 16.3 and later type-check with TypeScript 7 through its `tsc` CLI (`experimental.useTypeScriptCli`, on by
|
|
114
|
+
default). Earlier Next.js releases need TypeScript 6's compiler API, so an app on one of them stays on 0.9.x of this
|
|
115
|
+
package.
|
|
116
|
+
|
|
95
117
|
### Building with `tsc`
|
|
96
118
|
|
|
97
119
|
`library-build.json` is an overlay, not a standalone preset. It carries only the emit options, so layer it over your
|
|
@@ -113,6 +135,10 @@ development config in a separate `tsconfig.build.json`. List both in `extends` t
|
|
|
113
135
|
Then `tsc -p tsconfig.build.json` emits `.js`, `.d.ts`, and their maps into `dist/`. `isolatedDeclarations` requires an
|
|
114
136
|
explicit type annotation on every export, which is what lets declarations be produced file by file.
|
|
115
137
|
|
|
138
|
+
The overlay sets `types: []`, so the test types your development config loads (`vitest/globals`, for example) stay out
|
|
139
|
+
of the build. A package that runs on Node sets `types: ["node"]` again in its `tsconfig.build.json`. A browser or
|
|
140
|
+
universal package leaves it empty, so a Node global in its source fails the build.
|
|
141
|
+
|
|
116
142
|
## Notable compiler options
|
|
117
143
|
|
|
118
144
|
Every preset inherits its strictness from `base.json`:
|
package/base.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"exactOptionalPropertyTypes": true,
|
|
6
6
|
"forceConsistentCasingInFileNames": true,
|
|
7
7
|
"isolatedModules": true,
|
|
8
|
-
"lib": ["DOM", "DOM.Iterable", "
|
|
8
|
+
"lib": ["DOM", "DOM.Iterable", "ES2025"],
|
|
9
9
|
"module": "ESNext",
|
|
10
10
|
"moduleDetection": "force",
|
|
11
11
|
"moduleResolution": "bundler",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"resolveJsonModule": true,
|
|
16
16
|
"skipLibCheck": true,
|
|
17
17
|
"strict": true,
|
|
18
|
-
"target": "
|
|
18
|
+
"target": "ES2025",
|
|
19
19
|
"verbatimModuleSyntax": true
|
|
20
20
|
},
|
|
21
21
|
"display": "Base configuration for monorepo packages"
|
package/library-build.json
CHANGED
package/library.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/typescript-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Shared TypeScript configuration for the monorepo",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"url": "https://github.com/codefastlabs/codefast/issues"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"author": "Vuong Phan <mr.thevuong@gmail.com>",
|
|
21
|
+
"author": "Vuong Phan <mr.thevuong@gmail.com> (https://github.com/thevuong)",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "git+https://github.com/codefastlabs/codefast.git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"typescript": ">=
|
|
44
|
+
"typescript": ">=7.0.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24.0.0"
|