@codefast/typescript-config 0.9.1 → 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 +27 -0
- package/README.md +39 -16
- 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,32 @@
|
|
|
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
|
+
|
|
3
30
|
## 0.9.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,9 +17,12 @@ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothin
|
|
|
17
17
|
from the base that every preset extends.
|
|
18
18
|
- **Bundler-first.** An ESNext `module` with `moduleResolution: "bundler"`, so `exports` and `imports` maps resolve the
|
|
19
19
|
way Vite, esbuild, and friends resolve them.
|
|
20
|
-
- **`lib` and `target` are `
|
|
21
|
-
|
|
22
|
-
runtime crash on the floor.
|
|
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.
|
|
23
26
|
- **Type-check only.** The presets set `noEmit`; a separate build overlay turns on emit and `.d.ts` generation.
|
|
24
27
|
- **Plain JSON.** No runtime code, nothing to import.
|
|
25
28
|
|
|
@@ -29,9 +32,9 @@ The presets are plain JSON `tsconfig` files. There's no runtime code, and nothin
|
|
|
29
32
|
pnpm add -D @codefast/typescript-config
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
`@codefast/typescript-config` requires Node.js
|
|
33
|
-
|
|
34
|
-
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.
|
|
35
38
|
|
|
36
39
|
## Quick start
|
|
37
40
|
|
|
@@ -45,30 +48,30 @@ full file names only.
|
|
|
45
48
|
}
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
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:
|
|
49
52
|
|
|
50
53
|
```json
|
|
51
54
|
{
|
|
52
55
|
"extends": "@codefast/typescript-config/library.json",
|
|
53
56
|
"compilerOptions": {
|
|
54
|
-
"
|
|
57
|
+
"types": ["node"]
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
## Presets
|
|
60
63
|
|
|
61
|
-
| Preset | Extends | Purpose
|
|
62
|
-
| -------------------- | ----------- |
|
|
63
|
-
| `base.json` | — | Strict, bundler-first baseline:
|
|
64
|
-
| `library.json` | `base.json` | Headless packages: `lib` is `
|
|
65
|
-
| `react.json` | `base.json` | React with the automatic JSX runtime (`jsx: "react-jsx"`) — components need no `React` import.
|
|
66
|
-
| `next.json` | `base.json` | Next.js apps: `jsx: "preserve"`, `incremental` builds, and the `next` TypeScript plugin.
|
|
67
|
-
| `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. |
|
|
68
71
|
|
|
69
72
|
### Choosing a preset
|
|
70
73
|
|
|
71
|
-
A publishable package with no browser coupling:
|
|
74
|
+
A publishable package with no browser coupling, which runs wherever JavaScript runs:
|
|
72
75
|
|
|
73
76
|
```json
|
|
74
77
|
{
|
|
@@ -77,6 +80,18 @@ A publishable package with no browser coupling:
|
|
|
77
80
|
}
|
|
78
81
|
```
|
|
79
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
|
+
|
|
80
95
|
A React app or component library:
|
|
81
96
|
|
|
82
97
|
```json
|
|
@@ -95,6 +110,10 @@ A Next.js app:
|
|
|
95
110
|
}
|
|
96
111
|
```
|
|
97
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
|
+
|
|
98
117
|
### Building with `tsc`
|
|
99
118
|
|
|
100
119
|
`library-build.json` is an overlay, not a standalone preset. It carries only the emit options, so layer it over your
|
|
@@ -116,6 +135,10 @@ development config in a separate `tsconfig.build.json`. List both in `extends` t
|
|
|
116
135
|
Then `tsc -p tsconfig.build.json` emits `.js`, `.d.ts`, and their maps into `dist/`. `isolatedDeclarations` requires an
|
|
117
136
|
explicit type annotation on every export, which is what lets declarations be produced file by file.
|
|
118
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
|
+
|
|
119
142
|
## Notable compiler options
|
|
120
143
|
|
|
121
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",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"typescript": ">=
|
|
44
|
+
"typescript": ">=7.0.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
47
|
+
"node": ">=24.0.0"
|
|
48
48
|
}
|
|
49
49
|
}
|