summaryrefslogtreecommitdiff
path: root/www-client/ungoogled-chromium/files/chromium-157-system-typescript.patch
blob: 06cc579f263784ab38a1985c18369e57381cb142 (plain)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
--- a/third_party/devtools-frontend/src/front_end/core/host/DispatchHttpRequestClient.ts
+++ b/third_party/devtools-frontend/src/front_end/core/host/DispatchHttpRequestClient.ts
@@ -14,7 +14,7 @@ export enum ErrorType {
 }
 
 export class DispatchHttpRequestError extends Error {
-  constructor(readonly type: ErrorType, readonly response?: DispatchHttpRequestResult, options?: ErrorOptions) {
+  constructor(readonly type: ErrorType, readonly response?: DispatchHttpRequestResult | undefined, options?: ErrorOptions) {
     super(undefined, options);
   }
 }
--- a/third_party/devtools-frontend/src/front_end/ui/legacy/ARIAUtils.ts
+++ b/third_party/devtools-frontend/src/front_end/ui/legacy/ARIAUtils.ts
@@ -420,7 +420,7 @@ export class LiveAnnouncer {
     element.textContent = Platform.StringUtilities.trimEndWithMaxLength(announcedMessage, 10000);
   }
 
-  static getOrCreateAnnouncerElement(container: HTMLElement = document.body, role: AnnouncerRole, opts?: {
+  static getOrCreateAnnouncerElement(container: undefined | HTMLElement = document.body, role: AnnouncerRole, opts?: {
     force: boolean,
   }): HTMLElement {
     const existingAnnouncerElement = LiveAnnouncer.#announcerElementsByRole[role].get(container);
--- a/third_party/devtools-frontend/src/front_end/ui/legacy/Widget.ts
+++ b/third_party/devtools-frontend/src/front_end/ui/legacy/Widget.ts
@@ -84,7 +84,7 @@ export type WidgetFactory<WidgetT extend
 export type InferWidgetTFromFactory<F> = F extends WidgetFactory<infer WidgetT>? WidgetT : never;
 
 export class WidgetConfig<WidgetT extends AnyWidget> {
-  constructor(readonly widgetClass: WidgetFactory<WidgetT>, readonly widgetParams?: Partial<WidgetT>) {
+  constructor(readonly widgetClass: WidgetFactory<WidgetT>, readonly widgetParams?: Partial<WidgetT> | undefined) {
   }
 }
 
--- a/third_party/devtools-frontend/src/scripts/build/typescript/typescript_vars.gni
+++ b/third_party/devtools-frontend/src/scripts/build/typescript/typescript_vars.gni
@@ -6,7 +6,7 @@ import("//build/toolchain/rbe.gni")
 import("../ninja/vars.gni")
 
 if (host_os == "linux") {
-  tsc_binary = "//third_party/typescript/linux-amd64/src/lib/tsc"
+  tsc_binary = "/usr/bin/tsc"
 } else if (host_os == "win") {
   tsc_binary = "//third_party/typescript/windows-amd64/src/lib/tsc.exe"
 } else if (host_os == "mac") {
--- a/third_party/devtools-frontend/src/third_party/typescript/typescript.py
+++ b/third_party/devtools-frontend/src/third_party/typescript/typescript.py
@@ -10,6 +10,7 @@ import os
 
 
 def GetBinaryPath():
+    return "/usr/bin/tsc"
     if platform.machine() == 'arm64':
         darwin_path = 'mac-arm64'
     else:
--- a/third_party/typescript/tsgo.gni
+++ b/third_party/typescript/tsgo.gni
@@ -23,7 +23,7 @@ assert(defined(_platform_dir), "Did not
 
 tsgo_inputs = [
   "//third_party/typescript/typescript.py",
-  "//third_party/typescript/$_platform_dir/src/lib/$_binary_name",
+  "/usr/bin/tsc",
 ]
 
 _tsgo_lib_files = [
@@ -138,5 +138,5 @@ _tsgo_lib_files = [
 ]
 
 foreach(file, _tsgo_lib_files) {
-  tsgo_inputs += [ "//third_party/typescript/$_platform_dir/src/lib/$file" ]
+  tsgo_inputs += [ "//third_party/node/node_modules/typescript/lib/$file" ]
 }
--- a/tools/typescript/ts_definitions.py
+++ b/tools/typescript/ts_definitions.py
@@ -13,8 +13,9 @@ _CWD = os.getcwd()
 _HERE_DIR = os.path.dirname(__file__)
 _SRC_DIR = os.path.normpath(os.path.join(_HERE_DIR, '..', '..'))
 
-sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
-import typescript
+sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'node'))
+import node
+import node_modules
 
 
 _TSCONFIG_BASE = 'tsconfig_definitions_base.json'
@@ -40,6 +41,7 @@ def main(argv):
   parser.add_argument('--root_dir', required=True)
   parser.add_argument('--js_files', nargs='*', required=True)
   parser.add_argument('--path_mappings', nargs='*')
+  parser.add_argument('--use_typescript_go', action='store_true')
   args = parser.parse_args(argv)
 
   with open(
@@ -81,9 +83,22 @@ def main(argv):
       if os.path.exists(to_delete):
         os.remove(to_delete)
 
-  stdout = typescript.RunTypeScript(
-    ['--project', os.path.join(args.gen_dir, _TSCONFIG_GEN)]
-  )
+  stdout = None
+  if args.use_typescript_go:
+    sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
+    import typescript
+
+    stdout = typescript.RunTypeScript(
+      ['--project', os.path.join(args.gen_dir, _TSCONFIG_GEN)]
+    )
+  else:
+    stdout = node.RunNode(
+      [
+        node_modules.PathToTypescript(),
+        '--project',
+        os.path.join(args.gen_dir, _TSCONFIG_GEN),
+      ]
+    )
 
   # Verify that that no unexpected .d.ts files were generated.
   lines = stdout.splitlines()
--- a/tools/typescript/ts_library.py
+++ b/tools/typescript/ts_library.py
@@ -15,8 +15,9 @@ _CWD = os.getcwd()
 _HERE_DIR = os.path.dirname(__file__)
 _SRC_DIR = os.path.normpath(os.path.join(_HERE_DIR, '..', '..'))
 
-sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
-import typescript
+sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'node'))
+import node
+import node_modules
 
 from path_utils import isInAshFolder, getTargetPath
 from validate_tsconfig import (
@@ -70,6 +71,7 @@ def main(argv):
   )
   parser.add_argument('--enable_source_maps', action='store_true')
   parser.add_argument('--output_suffix', required=True)
+  parser.add_argument('--use_typescript_go', action='store_true')
   args = parser.parse_args(argv)
 
   root_dir = os.path.relpath(args.root_dir, args.gen_dir)
@@ -305,9 +307,21 @@ def main(argv):
             os.remove(to_check)
 
   try:
-    typescript.RunTypeScript(
-      ['--project', os.path.join(args.gen_dir, tsconfig_file)]
-    )
+    if args.use_typescript_go:
+      sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'typescript'))
+      import typescript
+
+      typescript.RunTypeScript(
+        ['--project', os.path.join(args.gen_dir, tsconfig_file)]
+      )
+    else:
+      node.RunNode(
+        [
+          node_modules.PathToTypescript(),
+          '--project',
+          os.path.join(args.gen_dir, tsconfig_file),
+        ]
+      )
   finally:
     if args.composite:
       # `.tsbuildinfo` is generated by TypeScript for incremenetal compilation
@@ -327,13 +341,24 @@ def main(argv):
 
   # Invoke the TS compiler again, with the --listFilesOnly flag, to detect any
   # files that are used by the build, but not properly declared as dependencies.
-  out = typescript.RunTypeScript(
-    [
-      '--project',
-      os.path.join(args.gen_dir, tsconfig_file),
-      '--listFilesOnly',
-    ]
-  )
+  out = None
+  if args.use_typescript_go:
+    out = typescript.RunTypeScript(
+      [
+        '--project',
+        os.path.join(args.gen_dir, tsconfig_file),
+        '--listFilesOnly',
+      ]
+    )
+  else:
+    out = node.RunNode(
+      [
+        node_modules.PathToTypescript(),
+        '--project',
+        os.path.join(args.gen_dir, tsconfig_file),
+        '--listFilesOnly',
+      ]
+    )
 
   files_list = out.split('\n')
   definitions_files = list(filter(lambda f: f.endswith('.d.ts'), files_list))