Skip to content

Commit e79b67f

Browse files
committed
Moves removing the static abort function to a part of the deploy process
1 parent c5e2df1 commit e79b67f

7 files changed

+36
-9
lines changed

baselines/dom.generated.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,7 @@ interface AbortSignal extends EventTarget {
19121912
declare var AbortSignal: {
19131913
prototype: AbortSignal;
19141914
new(): AbortSignal;
1915+
abort(): AbortSignal;
19151916
};
19161917

19171918
interface AbstractRange {

baselines/serviceworker.generated.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ interface AbortSignal extends EventTarget {
697697
declare var AbortSignal: {
698698
prototype: AbortSignal;
699699
new(): AbortSignal;
700+
abort(): AbortSignal;
700701
};
701702

702703
interface AbstractWorkerEventMap {

baselines/sharedworker.generated.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ interface AbortSignal extends EventTarget {
669669
declare var AbortSignal: {
670670
prototype: AbortSignal;
671671
new(): AbortSignal;
672+
abort(): AbortSignal;
672673
};
673674

674675
interface AbstractWorkerEventMap {

baselines/webworker.generated.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ interface AbortSignal extends EventTarget {
703703
declare var AbortSignal: {
704704
prototype: AbortSignal;
705705
new(): AbortSignal;
706+
abort(): AbortSignal;
706707
};
707708

708709
interface AbstractWorkerEventMap {

deploy/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
## Deploys
22

3-
We want to generate @types/xyz
3+
We want to take the `d.ts` files inside `generated` into a set of different `@types` packages. This infra all lives inside these files as multiple steps. For debugging you mostly want to run:
4+
5+
```sh
6+
node deploy/createTypesPackages.js
7+
```
8+
9+
Then look at `deploy/generated` to see the set of NPM packages.

deploy/createTypesPackages.js

+25
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const go = async () => {
9090
});
9191

9292
prependAutoImports(pkg, packagePath);
93+
postProcessDTSFiles(pkg, packagePath);
9394

9495
// Setup the files in the repo
9596
const newPkgJSON = await updatePackageJSON(pkg, packagePath);
@@ -188,6 +189,30 @@ function prependAutoImports(pkg, packagePath) {
188189
fs.writeFileSync(index, `${toPrepend}\n\n${indexText}`);
189190
}
190191

192+
/**
193+
* Handles any post-processing we do for deployment.
194+
* @param {Package} pkg
195+
* @param {URL} packagePath
196+
*/
197+
function postProcessDTSFiles(pkg, packagePath) {
198+
iterateThroughFiles((content) => {
199+
return content.replace(
200+
"abort(): AbortSignal;",
201+
"// abort(): AbortSignal; - To be re-added in the future"
202+
);
203+
});
204+
205+
/** @param {(str:string) => string} contentReplacer */
206+
function iterateThroughFiles(contentReplacer) {
207+
pkg.files.forEach((fileRef) => {
208+
const dtsFileURL = new URL(fileRef.to, packagePath);
209+
let dtsContent = fs.readFileSync(dtsFileURL, "utf-8");
210+
dtsContent = contentReplacer(dtsContent);
211+
fs.writeFileSync(dtsFileURL, dtsContent);
212+
});
213+
}
214+
}
215+
191216
if (process.argv[1] === fileURLToPath(import.meta.url)) {
192217
await go();
193218
}

inputfiles/removedTypes.jsonc

-8
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,6 @@
166166
"Text": {
167167
"implements": ["GeometryUtils"]
168168
},
169-
// This is hard to get in sync with @types/node
170-
"AbortSignal": {
171-
"methods": {
172-
"method": {
173-
"abort": null
174-
}
175-
}
176-
},
177169
"WebGLBuffer": {
178170
"extends": null
179171
},

0 commit comments

Comments
 (0)