Skip to content

Commit cfef773

Browse files
committed
feat(rollup): tests and docs for new rollup_bundle
1 parent 3873715 commit cfef773

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+458
-14
lines changed

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ bzl_library(
3737
"//internal/history-server:bzl",
3838
"//internal/http-server:bzl",
3939
"//internal/jasmine_node_test:bzl",
40+
"//internal/linker:bzl",
4041
"//internal/npm_package:bzl",
4142
"//internal/rollup:bzl",
4243
"//toolchains/node:bzl",
@@ -83,6 +84,7 @@ npm_package(
8384
"//third_party/npm/node_modules/named-amd:package_contents",
8485
"//internal:package_contents",
8586
"//internal/bazel_integration_test:package_contents",
87+
"//internal/golden_file_test:package_contents",
8688
"//internal/common:package_contents",
8789
"//internal/copy_repository:package_contents",
8890
"//internal/history-server:package_contents",

docs/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ _PACKAGE_READMES = {
4040
"Karma": "//packages/karma:README.md",
4141
"Less": "//packages/less:README.md",
4242
"Protractor": "//packages/protractor:README.md",
43+
"Rollup": "//packages/rollup:README.md",
4344
"Stylus": "//packages/stylus:README.md",
4445
"Terser": "//packages/terser:README.md",
4546
"TypeScript": "//packages/typescript:README.md",

e2e/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ e2e_integration_test(
103103
},
104104
)
105105

106+
e2e_integration_test(
107+
name = "e2e_rollup",
108+
npm_packages = {
109+
"//packages/rollup:npm_package": "@bazel/rollup",
110+
},
111+
)
112+
106113
e2e_integration_test(
107114
name = "e2e_ts_devserver",
108115
npm_packages = {

e2e/index.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ALL_E2E = [
1010
"node_loader_no_preserve_symlinks",
1111
"node_loader_preserve_symlinks",
1212
"packages",
13+
"rollup",
1314
"stylus",
1415
"symlinked_node_modules_npm",
1516
"symlinked_node_modules_yarn",

e2e/rollup/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import %workspace%/../../common.bazelrc

e2e/rollup/BUILD.bazel

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
load("@build_bazel_rules_nodejs//internal/golden_file_test:golden_file_test.bzl", "golden_file_test")
2+
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
3+
4+
rollup_bundle(
5+
name = "bundle",
6+
srcs = ["msg.js"],
7+
entry_point = "input.js",
8+
)
9+
10+
golden_file_test(
11+
name = "test",
12+
actual = "bundle/input.js",
13+
golden = "golden.js_",
14+
)
15+
16+
# For testing from the root workspace of this repository with bazel_integration_test.
17+
filegroup(
18+
name = "all_files",
19+
srcs = glob(
20+
include = ["**/*"],
21+
exclude = [
22+
"bazel-out/**/*",
23+
"dist/**/*",
24+
"node_modules/**/*",
25+
],
26+
),
27+
visibility = ["//visibility:public"],
28+
)

e2e/rollup/WORKSPACE

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2018 The Bazel Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
workspace(
16+
name = "e2e_rollup",
17+
managed_directories = {"@npm": ["node_modules"]},
18+
)
19+
20+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
21+
22+
http_archive(
23+
name = "build_bazel_rules_nodejs",
24+
sha256 = "da72ea53fa1cb8ab5ef7781ba06b97259b7d579a431ce480476266bc81bdf21d",
25+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.36.2/rules_nodejs-0.36.2.tar.gz"],
26+
)
27+
28+
load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")
29+
30+
yarn_install(
31+
name = "npm",
32+
package_json = "//:package.json",
33+
yarn_lock = "//:yarn.lock",
34+
)
35+
36+
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
37+
38+
install_bazel_dependencies()

e2e/rollup/golden.js_

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function hello(place) {
2+
return `Hello, ${place}`;
3+
}
4+
5+
console.log(hello('world'));
6+
//# sourceMappingURL=input.js.map

e2e/rollup/input.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {hello} from './msg';
2+
3+
console.log(hello('world'));

e2e/rollup/msg.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function hello(place) {
2+
return `Hello, ${place}`;
3+
}

0 commit comments

Comments
 (0)