Skip to content

Commit 5c5d446

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

7 files changed

+37
-9
lines changed

baselines/dom.generated.d.ts

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 7 additions & 1 deletion
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

Lines changed: 26 additions & 0 deletions
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,31 @@ 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+
199+
iterateThroughFiles((content)=> {
200+
return content.replace(
201+
"abort(): AbortSignal;",
202+
"// abort(): AbortSignal; - To be re-added in the future"
203+
);
204+
})
205+
206+
/** @param {(str:string) => string} contentReplacer */
207+
function iterateThroughFiles(contentReplacer) {
208+
pkg.files.forEach((fileRef) => {
209+
const dtsFileURL = new URL(fileRef.to, packagePath);
210+
let dtsContent = fs.readFileSync(dtsFileURL, "utf-8");
211+
dtsContent = contentReplacer(dtsContent)
212+
fs.writeFileSync(dtsFileURL, dtsContent);
213+
});
214+
}
215+
}
216+
191217
if (process.argv[1] === fileURLToPath(import.meta.url)) {
192218
await go();
193219
}

inputfiles/removedTypes.jsonc

Lines changed: 0 additions & 8 deletions
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)