blob: ecd8224ac07a74d01cdbc22e622eab94ae2b8744 [file] [log] [blame]
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("//internal:defaults.bzl", "ts_library")
package(default_visibility = ["//visibility:public"])
# We compile this library with the module name "sm" to make it possible to
# use `import {} from 'sm';` both at type-check time (we include the mapping in
# the paths map in tsconfig) as well as runtime (we patch the nodejs module
# loader to discover the path in the runfiles).
ts_library(
name = "some_module",
srcs = ["index.ts"],
module_name = "sm",
)
ts_library(
name = "main",
srcs = ["main.ts"],
deps = [":some_module"],
)
nodejs_binary(
name = "bin",
data = [
":main",
":some_module",
],
entry_point = "npm_bazel_typescript/examples/some_module/main.js",
)
sh_test(
name = "module_load_test",
srcs = ["module_load_test.sh"],
data = [
":bin",
"@bazel_tools//tools/bash/runfiles",
],
)