File tree Expand file tree Collapse file tree 4 files changed +37
-1
lines changed
packages/typescript/test/ts_project/directory_declarations Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,10 @@ def _impl(ctx):
157
157
js_files .append (file )
158
158
159
159
# register typings
160
- if (
160
+ if file .is_directory :
161
+ # assume a directory contains typings since we can't know that it doesn't
162
+ typings .append (file )
163
+ elif (
161
164
(
162
165
file .path .endswith (".d.ts" ) or
163
166
file .path .endswith (".d.ts.map" ) or
Original file line number Diff line number Diff line change
1
+ load ("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl" , "copy_file" )
2
+ load ("//:index.bzl" , "js_library" )
3
+ load ("//packages/typescript:index.bzl" , "ts_project" )
4
+
5
+ # Copy lib source directory to a TreeArtifact since bazel file.is_directory
6
+ # function does detect source directories
7
+ copy_file (
8
+ name = "lib_copy" ,
9
+ src = "lib" ,
10
+ # We must give this as the directory in order for it to appear on NODE_PATH
11
+ out = "lib_out" ,
12
+ # This attribute comes from rules_nodejs patch of
13
+ # https://github.com/bazelbuild/bazel-skylib/pull/323
14
+ is_directory = True ,
15
+ )
16
+
17
+ js_library (
18
+ name = "lib_js_library" ,
19
+ package_name = "directory_declarations_lib" ,
20
+ srcs = [":lib_copy" ],
21
+ package_path = package_name (),
22
+ strip_prefix = "lib_out" ,
23
+ )
24
+
25
+ ts_project (
26
+ name = "b" ,
27
+ srcs = ["b.ts" ],
28
+ tsconfig = {},
29
+ deps = [":lib_js_library" ],
30
+ )
Original file line number Diff line number Diff line change
1
+ import * as lib from 'directory_declarations_lib/a'
2
+ console . log ( lib . a )
Original file line number Diff line number Diff line change
1
+ export declare const a : string ;
You can’t perform that action at this time.
0 commit comments