|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Andy Dill <andy.dill@gmail.com> |
| 3 | +Date: Thu, 13 Feb 2020 20:06:42 -0800 |
| 4 | +Subject: fix: explicitly specify `typeRoots` |
| 5 | + |
| 6 | +fix: explicitly specify `typeRoots` to avoid crawling parent directories |
| 7 | + |
| 8 | +Upstream CL: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2070561 |
| 9 | + |
| 10 | +diff --git a/third_party/typescript/ts_library.py b/third_party/typescript/ts_library.py |
| 11 | +index 10f07e63..2ac797d3 100644 |
| 12 | +--- a/third_party/typescript/ts_library.py |
| 13 | ++++ b/third_party/typescript/ts_library.py |
| 14 | +@@ -41,6 +41,7 @@ def main(): |
| 15 | + parser.add_argument('-deps', '--deps', nargs='*', help='List of Ninja build dependencies') |
| 16 | + parser.add_argument('-dir', '--front_end_directory', required=True, help='Folder that contains source files') |
| 17 | + parser.add_argument('-b', '--tsconfig_output_location', required=True) |
| 18 | ++ parser.add_argument('-r', '--tsconfig_type_root', required=True) |
| 19 | + opts = parser.parse_args() |
| 20 | + with open(ROOT_TS_CONFIG_LOCATION) as root_tsconfig: |
| 21 | + try: |
| 22 | +@@ -53,6 +54,7 @@ def main(): |
| 23 | + tsconfig['files'] = [path.join(os.getcwd(), src) for src in opts.sources] + [path.abspath(GLOBAL_DEFS)] |
| 24 | + if (opts.deps is not None): |
| 25 | + tsconfig['references'] = [{'path': src} for src in opts.deps] |
| 26 | ++ tsconfig['compilerOptions']['typeRoots'] = [path.abspath(opts.tsconfig_type_root)] |
| 27 | + tsconfig['compilerOptions']['declaration'] = True |
| 28 | + tsconfig['compilerOptions']['composite'] = True |
| 29 | + tsconfig['compilerOptions']['rootDir'] = path.join(os.getcwd(), opts.front_end_directory) |
| 30 | +diff --git a/third_party/typescript/typescript.gni b/third_party/typescript/typescript.gni |
| 31 | +index 8a44f0e8..cc6fd295 100644 |
| 32 | +--- a/third_party/typescript/typescript.gni |
| 33 | ++++ b/third_party/typescript/typescript.gni |
| 34 | +@@ -40,6 +40,11 @@ template("ts_library") { |
| 35 | + "/$target_name-tsconfig.json", |
| 36 | + ] |
| 37 | + |
| 38 | ++ args += [ |
| 39 | ++ "--tsconfig_type_root", |
| 40 | ++ rebase_path("//third_party/devtools-frontend/src/node_modules/@types"), |
| 41 | ++ ] |
| 42 | ++ |
| 43 | + assert(defined(sources), "You must specify TypeScript sources") |
| 44 | + |
| 45 | + args += [ "--sources" ] + rebase_path(sources, root_build_dir) |
0 commit comments