File: tsc-workaround.patch

package info (click to toggle)
node-proxy-agents 0~2025070717-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,932 kB
  • sloc: javascript: 5,805; makefile: 39
file content (136 lines) | stat: -rw-r--r-- 4,016 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
From: Yadd <yadd@debian.org>
Date: Thu, 1 Aug 2024 09:28:06 +0000
Subject: tsc workarounds

Forwarded: not-needed
Last-Update: 2023-11-11
---
 packages/degenerator/src/compile.ts     | 10 ++++++++++
 packages/degenerator/src/degenerator.ts |  5 +++++
 packages/get-uri/tsconfig.json          |  3 ++-
 packages/https-proxy-agent/src/index.ts |  1 +
 packages/https-proxy-agent/test/test.ts |  1 +
 packages/socks-proxy-agent/src/index.ts |  1 +
 packages/tsconfig/base.json             |  3 +--
 7 files changed, 21 insertions(+), 3 deletions(-)

--- a/packages/degenerator/src/compile.ts
+++ b/packages/degenerator/src/compile.ts
@@ -68,20 +68,30 @@
 			resolvedHandle = vm.unwrapResult(resolvedResult);
 			return quickJSHandleToHost(vm, resolvedHandle);
 		} catch (err: unknown) {
+// @ts-ignore
 			if (err && typeof err === 'object' && 'cause' in err && err.cause) {
 				if (
+// @ts-ignore
 					typeof err.cause === 'object' &&
+// @ts-ignore
 					'stack' in err.cause &&
+// @ts-ignore
 					'name' in err.cause &&
+// @ts-ignore
 					'message' in err.cause &&
+// @ts-ignore
 					typeof err.cause.stack === 'string' &&
+// @ts-ignore
 					typeof err.cause.name === 'string' &&
+// @ts-ignore
 					typeof err.cause.message === 'string'
 				) {
 					// QuickJS Error `stack` does not include the name +
 					// message, so patch those in to behave more like V8
+// @ts-ignore
 					err.cause.stack = `${err.cause.name}: ${err.cause.message}\n${err.cause.stack}`;
 				}
+// @ts-ignore
 				throw err.cause;
 			}
 			throw err;
--- a/packages/degenerator/src/degenerator.ts
+++ b/packages/degenerator/src/degenerator.ts
@@ -33,6 +33,7 @@
 	let lastNamesLength = 0;
 	do {
 		lastNamesLength = names.length;
+// @ts-ignore
 		visit(ast, {
 			visitVariableDeclaration(path) {
 				if (path.node.declarations) {
@@ -83,7 +84,9 @@
 					path.node.async = true;
 
 					// Add function name to `names` array
+// @ts-ignore
 					if (!checkName(path.node.id.name, names)) {
+// @ts-ignore
 						names.push(path.node.id.name);
 					}
 				}
@@ -95,6 +98,7 @@
 
 	// Second pass is for adding `await` statements to any function
 	// invocations that match the given `names` array.
+// @ts-ignore
 	visit(ast, {
 		visitCallExpression(path) {
 			if (checkNames(path.node, names)) {
@@ -150,6 +154,7 @@
 		}
 	} else if (n.FunctionExpression.check(callee)) {
 		if (callee.id) {
+// @ts-ignore
 			name = callee.id.name;
 		} else {
 			return false;
--- a/packages/get-uri/tsconfig.json
+++ b/packages/get-uri/tsconfig.json
@@ -8,7 +8,7 @@
     "outDir": "dist",
     "sourceMap": true,
     "declaration": true,
-    "typeRoots": ["./@types", "./node_modules/@types"]
+    "typeRoots": ["./@types", "./node_modules/@types", "../../node_modules/@types"]
   },
   "include": ["src/**/*"],
   "exclude": ["node_modules"]
--- a/packages/https-proxy-agent/src/index.ts
+++ b/packages/https-proxy-agent/src/index.ts
@@ -150,6 +150,7 @@
 
 		const { connect, buffered } = await proxyResponsePromise;
 		req.emit('proxyConnect', connect);
+// @ts-ignore
 		this.emit('proxyConnect', connect, req);
 
 		if (connect.statusCode === 200) {
--- a/packages/https-proxy-agent/test/test.ts
+++ b/packages/https-proxy-agent/test/test.ts
@@ -118,6 +118,7 @@
 			});
 
 			const r = req(serverUrl, { agent });
+// @ts-ignore
 			const [connect] = await once(agent, 'proxyConnect');
 			expect(connect.statusCode).toEqual(200);
 			expect(connect.statusText).toEqual('Connection established');
--- a/packages/socks-proxy-agent/src/index.ts
+++ b/packages/socks-proxy-agent/src/index.ts
@@ -150,6 +150,7 @@
 					if (err) {
 						reject(err);
 					} else {
+// @ts-ignore
 						resolve(res);
 					}
 				});
--- a/packages/tsconfig/base.json
+++ b/packages/tsconfig/base.json
@@ -8,7 +8,6 @@
     "forceConsistentCasingInFileNames": true,
     "sourceMap": true,
     "inlineSources": false,
-    "isolatedModules": true,
     "moduleResolution": "node",
     "noUnusedLocals": false,
     "noUnusedParameters": false,