Skip to content

Commit 555fd03

Browse files
committed
chore: generate types with the TypeScript CLI instead of tooling
`tooling` is deprecated. Declarations are now emitted by `tsc` from the JSDoc in `lib/` into `types/`, as in webpack-dev-middleware: npm run build:types # del-cli types && tsc -p tsconfig.types.json && prettier --write types CI rebuilds them in the lint job and fails when the committed `types/` are out of date. `types.d.ts` stays the package's `types` entry and re-exports the generated declarations in the same shape as before: every class as value and type, the same helper types and `util.stringBufferUtils`. It is type-checked by `lint:types-test`. `@private` JSDoc tags are removed from `lib/` (no runtime change). `tsc` emits them as `private` members, which makes TypeScript compare classes nominally, so two installed copies of this package (even the same version) would reject each other's instances. Without them the classes stay structurally typed, as with the previous generated types. The `inherit-types` and `format-file-header` checks are removed with `tooling`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ThsbPWvW5vnYWEaFs2Q22F
1 parent 6f9c00e commit 555fd03

41 files changed

Lines changed: 1940 additions & 760 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/test.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
restore-keys: lint-eslint-
4545

4646
- run: npm run lint
47+
48+
- name: Build types
49+
run: npm run build:types
50+
51+
- name: Check types are up to date
52+
run: if [ -n "$(git status types --porcelain)" ]; then echo "Types are out of date. Update them by running 'npm run build:types'"; git status types --porcelain; exit 1; else echo "Types are up to date"; fi
4753
test:
4854
strategy:
4955
fail-fast: false

‎lib/CachedSource.js‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ class CachedSource extends Source {
124124
constructor(source, cachedData) {
125125
super();
126126
/**
127-
* @private
128127
* @type {Source | (() => Source)}
129128
*/
130129
this._source = source;
131130
/**
132-
* @private
133131
* @type {undefined | string}
134132
*/
135133
this._cachedSource = undefined;
@@ -139,27 +137,22 @@ class CachedSource extends Source {
139137
// branch count roughly in half.
140138
if (cachedData) {
141139
/**
142-
* @private
143140
* @type {boolean | undefined}
144141
*/
145142
this._cachedSourceType = cachedData.source;
146143
/**
147-
* @private
148144
* @type {Buffer | undefined}
149145
*/
150146
this._cachedBuffer = cachedData.buffer;
151147
/**
152-
* @private
153148
* @type {number | undefined}
154149
*/
155150
this._cachedSize = cachedData.size;
156151
/**
157-
* @private
158152
* @type {BufferedMaps}
159153
*/
160154
this._cachedMaps = cachedData.maps;
161155
/**
162-
* @private
163156
* @type {(string | Buffer)[] | undefined}
164157
*/
165158
this._cachedHashUpdate = cachedData.hash;
@@ -247,7 +240,6 @@ class CachedSource extends Source {
247240
}
248241

249242
/**
250-
* @private
251243
* @param {BufferEntry} cacheEntry cache entry
252244
* @returns {null | RawSourceMap} raw source map
253245
*/
@@ -262,7 +254,6 @@ class CachedSource extends Source {
262254
}
263255

264256
/**
265-
* @private
266257
* @returns {undefined | string} cached source
267258
*/
268259
_getCachedSource() {

‎lib/CompatSource.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class CompatSource extends Source {
4343
constructor(sourceLike) {
4444
super();
4545
/**
46-
* @private
4746
* @type {SourceLike}
4847
*/
4948
this._sourceLike = sourceLike;

‎lib/ConcatSource.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class ConcatSource extends Source {
3434
constructor(...args) {
3535
super();
3636
/**
37-
* @private
3837
* @type {Child[]}
3938
*/
4039
this._children = [];
@@ -55,7 +54,6 @@ class ConcatSource extends Source {
5554
}
5655

5756
/**
58-
* @private
5957
* @type {boolean}
6058
*/
6159
this._isOptimized = args.length === 0;

‎lib/OriginalSource.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,14 @@ class OriginalSource extends Source {
3636
const isBuffer = Buffer.isBuffer(value);
3737

3838
/**
39-
* @private
4039
* @type {undefined | string}
4140
*/
4241
this._value = isBuffer ? undefined : value;
4342
/**
44-
* @private
4543
* @type {undefined | Buffer}
4644
*/
4745
this._valueAsBuffer = isBuffer ? value : undefined;
4846
/**
49-
* @private
5047
* @type {string}
5148
*/
5249
this._name = name;

‎lib/PrefixSource.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ class PrefixSource extends Source {
5656
constructor(prefix, source) {
5757
super();
5858
/**
59-
* @private
6059
* @type {string}
6160
*/
6261
this._prefix = prefix;
6362
/**
64-
* @private
6563
* @type {Source}
6664
*/
6765
this._source =

‎lib/RawSource.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,18 @@ class RawSource extends Source {
3333
const isBuffer = Buffer.isBuffer(value);
3434
if (isBuffer) {
3535
/**
36-
* @private
3736
* @type {boolean}
3837
*/
3938
this._valueIsBuffer = !convertToString;
4039
/**
41-
* @private
4240
* @type {undefined | string | Buffer}
4341
*/
4442
this._value = convertToString ? undefined : value;
4543
/**
46-
* @private
4744
* @type {undefined | Buffer}
4845
*/
4946
this._valueAsBuffer = value;
5047
/**
51-
* @private
5248
* @type {undefined | string}
5349
*/
5450
this._valueAsString = undefined;

‎lib/ReplaceSource.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,16 @@ class ReplaceSource extends Source {
9292
constructor(source, name) {
9393
super();
9494
/**
95-
* @private
9695
* @type {Source}
9796
*/
9897
this._source = source;
9998
/**
100-
* @private
10199
* @type {string | undefined}
102100
*/
103101
this._name = name;
104102
/** @type {Replacement[]} */
105103
this._replacements = [];
106104
/**
107-
* @private
108105
* @type {boolean}
109106
*/
110107
this._isSorted = true;

‎lib/SizeOnlySource.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class SizeOnlySource extends Source {
1919
constructor(size) {
2020
super();
2121
/**
22-
* @private
2322
* @type {number}
2423
*/
2524
this._size = size;

‎lib/SourceMapSource.js‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ class SourceMapSource extends Source {
4545
super();
4646
const valueIsBuffer = Buffer.isBuffer(value);
4747
/**
48-
* @private
4948
* @type {undefined | string}
5049
*/
5150
this._valueAsString = valueIsBuffer ? undefined : value;
5251
/**
53-
* @private
5452
* @type {undefined | Buffer}
5553
*/
5654
this._valueAsBuffer = valueIsBuffer ? value : undefined;
@@ -61,18 +59,15 @@ class SourceMapSource extends Source {
6159
const sourceMapIsBuffer = Buffer.isBuffer(sourceMap);
6260
const sourceMapIsString = typeof sourceMap === "string";
6361
/**
64-
* @private
6562
* @type {undefined | RawSourceMap}
6663
*/
6764
this._sourceMapAsObject =
6865
sourceMapIsBuffer || sourceMapIsString ? undefined : sourceMap;
6966
/**
70-
* @private
7167
* @type {undefined | string}
7268
*/
7369
this._sourceMapAsString = sourceMapIsString ? sourceMap : undefined;
7470
/**
75-
* @private
7671
* @type {undefined | Buffer}
7772
*/
7873
this._sourceMapAsBuffer = sourceMapIsBuffer ? sourceMap : undefined;
@@ -90,7 +85,6 @@ class SourceMapSource extends Source {
9085
const innerSourceMapIsBuffer = Buffer.isBuffer(innerSourceMap);
9186
const innerSourceMapIsString = typeof innerSourceMap === "string";
9287
/**
93-
* @private
9488
* @type {undefined | RawSourceMap}
9589
*/
9690

@@ -99,14 +93,12 @@ class SourceMapSource extends Source {
9993
? undefined
10094
: innerSourceMap || undefined;
10195
/**
102-
* @private
10396
* @type {undefined | string}
10497
*/
10598
this._innerSourceMapAsString = innerSourceMapIsString
10699
? innerSourceMap
107100
: undefined;
108101
/**
109-
* @private
110102
* @type {undefined | Buffer}
111103
*/
112104
this._innerSourceMapAsBuffer = innerSourceMapIsBuffer
@@ -178,7 +170,6 @@ class SourceMapSource extends Source {
178170
}
179171

180172
/**
181-
* @private
182173
* @returns {undefined | Buffer} buffer
183174
*/
184175
_originalSourceBuffer() {
@@ -232,7 +223,6 @@ class SourceMapSource extends Source {
232223
}
233224

234225
/**
235-
* @private
236226
* @returns {string} result
237227
*/
238228
_innerSourceMapString() {

0 commit comments

Comments
 (0)