Skip to content

Commit

Permalink
Merge pull request #12 from Canva/jordan-mele_new-ts-files-declaratio…
Browse files Browse the repository at this point in the history
…n-info

Add `.d.cts`, `.d.cts.map`, `.d.mts`, `.d.mts.map` and `package.json` to `DeclarationInfo` provider
  • Loading branch information
Silic0nS0ldier authored Nov 15, 2023
2 parents d9c2214 + e7d4558 commit c112d47
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions internal/js_library/js_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,14 @@ def _impl(ctx):

# register typings
if (
(
file.path.endswith(".d.ts") or
file.path.endswith(".d.ts.map") or
# package.json may be required to resolve "typings" key
file.path.endswith("/package.json")
) and
# exclude eg. external/npm/node_modules/protobufjs/node_modules/@types/node/index.d.ts
# these would be duplicates of the typings provided directly in another dependency.
# also exclude all /node_modules/typescript/lib/lib.*.d.ts files as these are determined by
# the tsconfig "lib" attribute
len(file.path.split("/node_modules/")) < 3 and file.path.find("/node_modules/typescript/lib/lib.") == -1
file.path.endswith(".d.ts") or
file.path.endswith(".d.ts.map") or
file.path.endswith(".d.cts") or
file.path.endswith(".d.cts.map") or
file.path.endswith(".d.mts") or
file.path.endswith(".d.mts.map") or
# package.json may be required to resolve "typings" key
file.path.endswith("/package.json")
):
typings.append(file)

Expand Down

0 comments on commit c112d47

Please sign in to comment.