From 1926d9b5119725dfaf1ff824c0084852bf861197 Mon Sep 17 00:00:00 2001 From: Lukas Holzer Date: Fri, 9 Oct 2020 12:22:13 +0200 Subject: [PATCH] build(components-e2e): Bazelify components-e2e app. --- .bazelrc | 6 +- WORKSPACE | 1 + apps/components-e2e/BUILD.bazel | 14 +- apps/components-e2e/src/BUILD.bazel | 28 + apps/components-e2e/src/app/BUILD.bazel | 54 ++ apps/components-e2e/src/app/app.module.ts | 2 - .../src/app/app.routing.module.ts | 4 +- .../src/components/autocomplete/BUILD.bazel | 24 + .../src/components/button-group/BUILD.bazel | 23 + .../src/components/button/BUILD.bazel | 23 + .../src/components/chart/BUILD.bazel | 57 ++ .../chart/selection-area/BUILD.bazel | 29 + .../src/components/checkbox/BUILD.bazel | 23 + .../src/components/combobox/BUILD.bazel | 23 + .../confirmation-dialog/BUILD.bazel | 23 + .../src/components/consumption/BUILD.bazel | 25 + .../src/components/context-dialog/BUILD.bazel | 24 + .../src/components/drawer/BUILD.bazel | 28 + .../src/components/drawer/drawer.scss | 7 - .../src/components/drawer/drawer.ts | 12 +- .../src/components/empty-state/BUILD.bazel | 23 + .../src/components/event-chart/BUILD.bazel | 23 + .../components/expandable-panel/BUILD.bazel | 23 + .../components/expandable-section/BUILD.bazel | 23 + .../src/components/filter-field/BUILD.bazel | 25 + .../src/components/highlight/BUILD.bazel | 23 + .../src/components/key-value-list/BUILD.bazel | 23 + .../src/components/overlay/BUILD.bazel | 23 + .../src/components/pagination/BUILD.bazel | 23 + .../src/components/progress-bar/BUILD.bazel | 23 + .../src/components/quick-filter/BUILD.bazel | 30 + .../quick-filter/quick-filter/quick-filter.ts | 4 +- .../src/components/radial-chart/BUILD.bazel | 23 + .../src/components/radio/BUILD.bazel | 23 + .../src/components/select/BUILD.bazel | 23 + .../src/components/show-more/BUILD.bazel | 23 + .../src/components/slider/BUILD.bazel | 23 + .../stacked-series-chart/BUILD.bazel | 23 + .../src/components/sunburst-chart/BUILD.bazel | 24 + .../src/components/switch/BUILD.bazel | 23 + .../src/components/table/BUILD.bazel | 27 + .../table-expandable.html | 0 .../table-expandable.ts | 0 .../{table-order => table}/table.e2e.ts | 4 +- .../{table-order => table}/table.module.ts | 2 +- .../{table-order => table}/table.po.ts | 0 .../table-order => table/table}/table.html | 0 .../table-order => table/table}/table.ts | 0 .../src/components/tabs/BUILD.bazel | 23 + .../src/components/tag/BUILD.bazel | 26 + .../src/components/tile/BUILD.bazel | 23 + .../src/components/tree-table/BUILD.bazel | 26 + .../chart/chart-series.ts => main.dev.ts} | 13 +- apps/components-e2e/src/main.prod.ts | 23 + apps/components-e2e/src/main.scss | 2 + apps/components-e2e/src/main.ts | 7 + apps/components-e2e/src/services/BUILD.bazel | 14 + .../context-dialog/index.ts | 3 +- .../experimental/combobox/BUILD.bazel | 2 +- .../stacked-series-chart/index.ts | 9 +- libs/barista-components/style/BUILD.bazel | 36 +- .../sunburst-chart/index.ts | 3 +- libs/barista-components/tabs/index.ts | 8 +- libs/examples/BUILD.bazel | 12 +- libs/examples/src/filter-field/BUILD.bazel | 17 + libs/examples/src/quick-filter/BUILD.bazel | 18 + libs/examples/tsconfig.lib.json | 2 +- rules_sass-pr-122.patch | 574 ++++++++++++++++ test-sass.patch | 618 ++++++++++++++++++ 69 files changed, 2331 insertions(+), 42 deletions(-) create mode 100644 apps/components-e2e/src/BUILD.bazel create mode 100644 apps/components-e2e/src/app/BUILD.bazel create mode 100644 apps/components-e2e/src/components/autocomplete/BUILD.bazel create mode 100644 apps/components-e2e/src/components/button-group/BUILD.bazel create mode 100644 apps/components-e2e/src/components/button/BUILD.bazel create mode 100644 apps/components-e2e/src/components/chart/BUILD.bazel create mode 100644 apps/components-e2e/src/components/chart/selection-area/BUILD.bazel create mode 100644 apps/components-e2e/src/components/checkbox/BUILD.bazel create mode 100644 apps/components-e2e/src/components/combobox/BUILD.bazel create mode 100644 apps/components-e2e/src/components/confirmation-dialog/BUILD.bazel create mode 100644 apps/components-e2e/src/components/consumption/BUILD.bazel create mode 100644 apps/components-e2e/src/components/context-dialog/BUILD.bazel create mode 100644 apps/components-e2e/src/components/drawer/BUILD.bazel delete mode 100644 apps/components-e2e/src/components/drawer/drawer.scss create mode 100644 apps/components-e2e/src/components/empty-state/BUILD.bazel create mode 100644 apps/components-e2e/src/components/event-chart/BUILD.bazel create mode 100644 apps/components-e2e/src/components/expandable-panel/BUILD.bazel create mode 100644 apps/components-e2e/src/components/expandable-section/BUILD.bazel create mode 100644 apps/components-e2e/src/components/filter-field/BUILD.bazel create mode 100644 apps/components-e2e/src/components/highlight/BUILD.bazel create mode 100644 apps/components-e2e/src/components/key-value-list/BUILD.bazel create mode 100644 apps/components-e2e/src/components/overlay/BUILD.bazel create mode 100644 apps/components-e2e/src/components/pagination/BUILD.bazel create mode 100644 apps/components-e2e/src/components/progress-bar/BUILD.bazel create mode 100644 apps/components-e2e/src/components/quick-filter/BUILD.bazel create mode 100644 apps/components-e2e/src/components/radial-chart/BUILD.bazel create mode 100644 apps/components-e2e/src/components/radio/BUILD.bazel create mode 100644 apps/components-e2e/src/components/select/BUILD.bazel create mode 100644 apps/components-e2e/src/components/show-more/BUILD.bazel create mode 100644 apps/components-e2e/src/components/slider/BUILD.bazel create mode 100644 apps/components-e2e/src/components/stacked-series-chart/BUILD.bazel create mode 100644 apps/components-e2e/src/components/sunburst-chart/BUILD.bazel create mode 100644 apps/components-e2e/src/components/switch/BUILD.bazel create mode 100644 apps/components-e2e/src/components/table/BUILD.bazel rename apps/components-e2e/src/components/{table-order => table}/table-order-expandable/table-expandable.html (100%) rename apps/components-e2e/src/components/{table-order => table}/table-order-expandable/table-expandable.ts (100%) rename apps/components-e2e/src/components/{table-order => table}/table.e2e.ts (99%) rename apps/components-e2e/src/components/{table-order => table}/table.module.ts (96%) rename apps/components-e2e/src/components/{table-order => table}/table.po.ts (100%) rename apps/components-e2e/src/components/{table-order/table-order => table/table}/table.html (100%) rename apps/components-e2e/src/components/{table-order/table-order => table/table}/table.ts (100%) create mode 100644 apps/components-e2e/src/components/tabs/BUILD.bazel create mode 100644 apps/components-e2e/src/components/tag/BUILD.bazel create mode 100644 apps/components-e2e/src/components/tile/BUILD.bazel create mode 100644 apps/components-e2e/src/components/tree-table/BUILD.bazel rename apps/components-e2e/src/{components/chart/chart/chart-series.ts => main.dev.ts} (70%) create mode 100644 apps/components-e2e/src/main.prod.ts create mode 100644 apps/components-e2e/src/services/BUILD.bazel create mode 100644 libs/examples/src/filter-field/BUILD.bazel create mode 100644 libs/examples/src/quick-filter/BUILD.bazel create mode 100644 rules_sass-pr-122.patch create mode 100644 test-sass.patch diff --git a/.bazelrc b/.bazelrc index e2a0dc8695..1b3b834077 100644 --- a/.bazelrc +++ b/.bazelrc @@ -100,7 +100,11 @@ build --strategy=AngularTemplateCompile=worker # Use the Angular Ivy compiler # See https://github.com/angular/angular/blob/master/docs/BAZEL.md#various-flags-used-for-tests -# build --define=angular_ivy_enabled=False +build:view-engine --define=angular_ivy_enabled=False +build:ivy --define=angular_ivy_enabled=True + +# Set Ivy as the default +build --config=view-engine # Angular Architect (Angular CLI) # The Angular CLI will by default try to write to a cache, but under Bazel it's a read only fs diff --git a/WORKSPACE b/WORKSPACE index 329d03493b..1d33a87d1e 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -39,6 +39,7 @@ http_archive( "https://github.com/bazelbuild/rules_sass/archive/%s.zip" % RULES_SASS_VERSION, "https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/%s.zip" % RULES_SASS_VERSION, ], + patches = [ "//:rules_sass-pr-122.patch"] ) ########################################### diff --git a/apps/components-e2e/BUILD.bazel b/apps/components-e2e/BUILD.bazel index 4e234258e6..904aa2d3d2 100644 --- a/apps/components-e2e/BUILD.bazel +++ b/apps/components-e2e/BUILD.bazel @@ -1,9 +1,19 @@ load("//tools/bazel_rules:index.bzl", "stylelint") +load("@npm//@bazel/typescript:index.bzl", "ts_config") -package(default_visibility = ["//:__subpackages__"]) +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) stylelint( name = "stylelint", srcs = glob(["**/*.scss"]), - config = ":.stylelintrc" + config = ":.stylelintrc", +) + +ts_config( + name = "tsconfig-app", + src = ":tsconfig.app.json", + deps = [ + ":tsconfig.json", + "//:tsconfig.base.json", + ], ) diff --git a/apps/components-e2e/src/BUILD.bazel b/apps/components-e2e/src/BUILD.bazel new file mode 100644 index 0000000000..df484a7bdb --- /dev/null +++ b/apps/components-e2e/src/BUILD.bazel @@ -0,0 +1,28 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") +load("@io_bazel_rules_sass//:defs.bzl", "sass_binary") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "src", + srcs = [ + "main.dev.ts", + "main.prod.ts", + ], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//apps/components-e2e/src/app", + "@npm//@angular/core", + "@npm//@angular/platform-browser", + ], +) + +sass_binary( + name = "styles", + src = "main.scss", + include_paths = ["external/npm"], + output_name = "styles.css", + deps = [ + "//libs/barista-components/style" + ], +) diff --git a/apps/components-e2e/src/app/BUILD.bazel b/apps/components-e2e/src/app/BUILD.bazel new file mode 100644 index 0000000000..80d4d4d706 --- /dev/null +++ b/apps/components-e2e/src/app/BUILD.bazel @@ -0,0 +1,54 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ROUTES = [ + "//apps/components-e2e/src/components/autocomplete", + "//apps/components-e2e/src/components/button", + "//apps/components-e2e/src/components/button-group", + "//apps/components-e2e/src/components/chart", + "//apps/components-e2e/src/components/checkbox", + "//apps/components-e2e/src/components/combobox", + "//apps/components-e2e/src/components/confirmation-dialog", + "//apps/components-e2e/src/components/consumption", + "//apps/components-e2e/src/components/context-dialog", + "//apps/components-e2e/src/components/drawer", + "//apps/components-e2e/src/components/empty-state", + "//apps/components-e2e/src/components/event-chart", + "//apps/components-e2e/src/components/expandable-panel", + "//apps/components-e2e/src/components/expandable-section", + "//apps/components-e2e/src/components/filter-field", + "//apps/components-e2e/src/components/highlight", + "//apps/components-e2e/src/components/key-value-list", + "//apps/components-e2e/src/components/overlay", + "//apps/components-e2e/src/components/pagination", + "//apps/components-e2e/src/components/progress-bar", + "//apps/components-e2e/src/components/quick-filter", + "//apps/components-e2e/src/components/radial-chart", + "//apps/components-e2e/src/components/radio", + "//apps/components-e2e/src/components/select", + "//apps/components-e2e/src/components/show-more", + "//apps/components-e2e/src/components/slider", + "//apps/components-e2e/src/components/stacked-series-chart", + "//apps/components-e2e/src/components/sunburst-chart", + "//apps/components-e2e/src/components/switch", + "//apps/components-e2e/src/components/table", + "//apps/components-e2e/src/components/tabs", + "//apps/components-e2e/src/components/tag", + "//apps/components-e2e/src/components/tile", + "//apps/components-e2e/src/components/tree-table", +] + +ng_module( + name = "app", + srcs = glob(["*.ts"]), + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = ROUTES + [ + "//libs/barista-components/icon:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/forms", + "@npm//@angular/platform-browser", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/app/app.module.ts b/apps/components-e2e/src/app/app.module.ts index 53d3d70e3c..306e1ae8a7 100644 --- a/apps/components-e2e/src/app/app.module.ts +++ b/apps/components-e2e/src/app/app.module.ts @@ -22,7 +22,6 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { DtIconModule } from '@dynatrace/barista-components/icon'; import { DtE2EApp } from './app.component'; import { AppRoutingModule } from './app.routing.module'; -import { DtOverlayModule } from '@dynatrace/barista-components/overlay'; @NgModule({ declarations: [DtE2EApp], @@ -33,7 +32,6 @@ import { DtOverlayModule } from '@dynatrace/barista-components/overlay'; HttpClientModule, DtIconModule.forRoot({ svgIconLocation: '/assets/icons/{{name}}.svg' }), AppRoutingModule, - DtOverlayModule, ], bootstrap: [DtE2EApp], }) diff --git a/apps/components-e2e/src/app/app.routing.module.ts b/apps/components-e2e/src/app/app.routing.module.ts index 0e7b497944..7892fc83c1 100644 --- a/apps/components-e2e/src/app/app.routing.module.ts +++ b/apps/components-e2e/src/app/app.routing.module.ts @@ -209,9 +209,9 @@ export const routes: Routes = [ ), }, { - path: 'table-order', + path: 'table', loadChildren: () => - import('../components/table-order/table.module').then( + import('../components/table/table.module').then( (module) => module.DtE2ETableModule, ), }, diff --git a/apps/components-e2e/src/components/autocomplete/BUILD.bazel b/apps/components-e2e/src/components/autocomplete/BUILD.bazel new file mode 100644 index 0000000000..305723153f --- /dev/null +++ b/apps/components-e2e/src/components/autocomplete/BUILD.bazel @@ -0,0 +1,24 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "autocomplete", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["autocomplete.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/autocomplete:compile", + "//libs/barista-components/core:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/forms", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/button-group/BUILD.bazel b/apps/components-e2e/src/components/button-group/BUILD.bazel new file mode 100644 index 0000000000..2940bdab2d --- /dev/null +++ b/apps/components-e2e/src/components/button-group/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "button-group", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["button-group.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/button-group:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/button/BUILD.bazel b/apps/components-e2e/src/components/button/BUILD.bazel new file mode 100644 index 0000000000..686a009511 --- /dev/null +++ b/apps/components-e2e/src/components/button/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "button", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["button.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/button:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/chart/BUILD.bazel b/apps/components-e2e/src/components/chart/BUILD.bazel new file mode 100644 index 0000000000..596208624c --- /dev/null +++ b/apps/components-e2e/src/components/chart/BUILD.bazel @@ -0,0 +1,57 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") +load("@npm//@bazel/typescript:index.bzl", "ts_library") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "chart", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "chart-base.ts", + "chart-options.ts", + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = [ + "chart/chart.html", + "heatfield/heatfield.html", + "highcharts/chart-highcharts-ui.html", + "pie-chart/pie-chart.html", + ], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//apps/components-e2e/src/components/chart/selection-area", + "//libs/barista-components/chart:compile", + "//libs/barista-components/core:compile", + "//libs/testing/fixtures", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + "@npm//highcharts", + "@npm//rxjs", + ], +) + +ts_library( + name = "chart-base", + srcs = ["chart-base.ts"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + ":chart-options", + "//apps/components-e2e/src/services", + "@npm//highcharts", + "@npm//rxjs", + "@npm//tslib", + ], +) + +ts_library( + name = "chart-options", + srcs = ["chart-options.ts"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "@npm//tslib", + ], +) diff --git a/apps/components-e2e/src/components/chart/selection-area/BUILD.bazel b/apps/components-e2e/src/components/chart/selection-area/BUILD.bazel new file mode 100644 index 0000000000..9c5c02921c --- /dev/null +++ b/apps/components-e2e/src/components/chart/selection-area/BUILD.bazel @@ -0,0 +1,29 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "selection-area", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = [ + "range/range.html", + "timestamp/timestamp.html", + "selection-area.html", + ], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//apps/components-e2e/src/components/chart:chart-base", + "//apps/components-e2e/src/services", + "//libs/barista-components/button:compile", + "//libs/barista-components/chart:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/checkbox/BUILD.bazel b/apps/components-e2e/src/components/checkbox/BUILD.bazel new file mode 100644 index 0000000000..b925f3b4d6 --- /dev/null +++ b/apps/components-e2e/src/components/checkbox/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "checkbox", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["checkbox.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/checkbox:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/combobox/BUILD.bazel b/apps/components-e2e/src/components/combobox/BUILD.bazel new file mode 100644 index 0000000000..801b2a899d --- /dev/null +++ b/apps/components-e2e/src/components/combobox/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "combobox", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["combobox.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/experimental/combobox:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/confirmation-dialog/BUILD.bazel b/apps/components-e2e/src/components/confirmation-dialog/BUILD.bazel new file mode 100644 index 0000000000..41b42551c0 --- /dev/null +++ b/apps/components-e2e/src/components/confirmation-dialog/BUILD.bazel @@ -0,0 +1,23 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "confirmation-dialog", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["confirmation-dialog.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/confirmation-dialog:compile", + "//libs/barista-components/core:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/consumption/BUILD.bazel b/apps/components-e2e/src/components/consumption/BUILD.bazel new file mode 100644 index 0000000000..98d3ceac4f --- /dev/null +++ b/apps/components-e2e/src/components/consumption/BUILD.bazel @@ -0,0 +1,25 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "consumption", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["consumption.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/consumption:compile", + "//libs/barista-components/core:compile", + "//libs/barista-components/icon:compile", + "//libs/barista-components/overlay:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/context-dialog/BUILD.bazel b/apps/components-e2e/src/components/context-dialog/BUILD.bazel new file mode 100644 index 0000000000..32c8c53eb7 --- /dev/null +++ b/apps/components-e2e/src/components/context-dialog/BUILD.bazel @@ -0,0 +1,24 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "context-dialog", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["context-dialog.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/context-dialog:compile", + "//libs/barista-components/core:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/drawer/BUILD.bazel b/apps/components-e2e/src/components/drawer/BUILD.bazel new file mode 100644 index 0000000000..a0ca2988d0 --- /dev/null +++ b/apps/components-e2e/src/components/drawer/BUILD.bazel @@ -0,0 +1,28 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "drawer", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["drawer.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//apps/components-e2e/src/components/chart:chart-options", + "//apps/components-e2e/src/services", + "//libs/barista-components/chart:compile", + "//libs/barista-components/drawer:compile", + "//libs/barista-components/overlay:compile", + "@npm//@angular/cdk", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + "@npm//rxjs", + ], +) diff --git a/apps/components-e2e/src/components/drawer/drawer.scss b/apps/components-e2e/src/components/drawer/drawer.scss deleted file mode 100644 index f77f081a09..0000000000 --- a/apps/components-e2e/src/components/drawer/drawer.scss +++ /dev/null @@ -1,7 +0,0 @@ -.content-trigger { - position: absolute; - top: 0; - right: 0; - // this is the highest possible z-index (integer max range) - z-index: 2147483647; -} diff --git a/apps/components-e2e/src/components/drawer/drawer.ts b/apps/components-e2e/src/components/drawer/drawer.ts index f07cd06097..5a4ed59bfa 100644 --- a/apps/components-e2e/src/components/drawer/drawer.ts +++ b/apps/components-e2e/src/components/drawer/drawer.ts @@ -28,7 +28,17 @@ import { options as chartOptions } from '../chart/chart-options'; @Component({ selector: 'dt-e2e-drawer', templateUrl: 'drawer.html', - styleUrls: ['drawer.scss'], + styles: [ + ` + .content-trigger { + position: absolute; + top: 0; + right: 0; + // this is the highest possible z-index (integer max range) + z-index: 2147483647; + } + `, + ], }) export class DtE2EDrawer { openCount = 0; diff --git a/apps/components-e2e/src/components/empty-state/BUILD.bazel b/apps/components-e2e/src/components/empty-state/BUILD.bazel new file mode 100644 index 0000000000..9d42925cad --- /dev/null +++ b/apps/components-e2e/src/components/empty-state/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "empty-state", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["empty-state.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/empty-state:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/event-chart/BUILD.bazel b/apps/components-e2e/src/components/event-chart/BUILD.bazel new file mode 100644 index 0000000000..1de7accccf --- /dev/null +++ b/apps/components-e2e/src/components/event-chart/BUILD.bazel @@ -0,0 +1,23 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "event-chart", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["event-chart.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/event-chart:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/expandable-panel/BUILD.bazel b/apps/components-e2e/src/components/expandable-panel/BUILD.bazel new file mode 100644 index 0000000000..aee5c293cb --- /dev/null +++ b/apps/components-e2e/src/components/expandable-panel/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "expandable-panel", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["expandable-panel.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/expandable-panel:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/expandable-section/BUILD.bazel b/apps/components-e2e/src/components/expandable-section/BUILD.bazel new file mode 100644 index 0000000000..3672003094 --- /dev/null +++ b/apps/components-e2e/src/components/expandable-section/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "expandable-section", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["expandable-section.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/expandable-section:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/filter-field/BUILD.bazel b/apps/components-e2e/src/components/filter-field/BUILD.bazel new file mode 100644 index 0000000000..ed5627eaef --- /dev/null +++ b/apps/components-e2e/src/components/filter-field/BUILD.bazel @@ -0,0 +1,25 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "filter-field", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["filter-field.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/filter-field:compile", + "//libs/examples/src/filter-field", + "//libs/testing/fixtures", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + "@npm//rxjs", + ], +) diff --git a/apps/components-e2e/src/components/highlight/BUILD.bazel b/apps/components-e2e/src/components/highlight/BUILD.bazel new file mode 100644 index 0000000000..9a6018fd5e --- /dev/null +++ b/apps/components-e2e/src/components/highlight/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "highlight", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["highlight.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/highlight:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/key-value-list/BUILD.bazel b/apps/components-e2e/src/components/key-value-list/BUILD.bazel new file mode 100644 index 0000000000..c3cdf48d3a --- /dev/null +++ b/apps/components-e2e/src/components/key-value-list/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "key-value-list", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["key-value-list.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/key-value-list:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/overlay/BUILD.bazel b/apps/components-e2e/src/components/overlay/BUILD.bazel new file mode 100644 index 0000000000..6283f144bf --- /dev/null +++ b/apps/components-e2e/src/components/overlay/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "overlay", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["overlay.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/overlay:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/pagination/BUILD.bazel b/apps/components-e2e/src/components/pagination/BUILD.bazel new file mode 100644 index 0000000000..e95cd4c464 --- /dev/null +++ b/apps/components-e2e/src/components/pagination/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "pagination", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["pagination.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/pagination:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/progress-bar/BUILD.bazel b/apps/components-e2e/src/components/progress-bar/BUILD.bazel new file mode 100644 index 0000000000..d38bd354de --- /dev/null +++ b/apps/components-e2e/src/components/progress-bar/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "progress-bar", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["progress-bar.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/progress-bar:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/quick-filter/BUILD.bazel b/apps/components-e2e/src/components/quick-filter/BUILD.bazel new file mode 100644 index 0000000000..1fa4322763 --- /dev/null +++ b/apps/components-e2e/src/components/quick-filter/BUILD.bazel @@ -0,0 +1,30 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "quick-filter", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = [ + "quick-filter/quick-filter.html", + "quick-filter-async/quick-filter-async.html", + "quick-filter-initial-data/quick-filter-initial-data.html", + ], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/experimental/quick-filter:compile", + "//libs/examples/src/quick-filter", + "//libs/testing/fixtures", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + "@npm//lodash-es", + ], +) diff --git a/apps/components-e2e/src/components/quick-filter/quick-filter/quick-filter.ts b/apps/components-e2e/src/components/quick-filter/quick-filter/quick-filter.ts index 02310cdac2..7cf493b79d 100644 --- a/apps/components-e2e/src/components/quick-filter/quick-filter/quick-filter.ts +++ b/apps/components-e2e/src/components/quick-filter/quick-filter/quick-filter.ts @@ -38,7 +38,9 @@ const config: DtQuickFilterDefaultDataSourceConfig = { templateUrl: 'quick-filter.html', }) export class DtE2EQuickFilter { - _dataSource = new DtQuickFilterDefaultDataSource(DATA[1], config); + _dataSource: DtQuickFilterDefaultDataSource< + any + > = new DtQuickFilterDefaultDataSource(DATA[1], config); filterChanges(filterEvent: DtQuickFilterChangeEvent): void { console.log(filterEvent); diff --git a/apps/components-e2e/src/components/radial-chart/BUILD.bazel b/apps/components-e2e/src/components/radial-chart/BUILD.bazel new file mode 100644 index 0000000000..f1ac33b630 --- /dev/null +++ b/apps/components-e2e/src/components/radial-chart/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "radial-chart", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["radial-chart.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/radial-chart:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/radio/BUILD.bazel b/apps/components-e2e/src/components/radio/BUILD.bazel new file mode 100644 index 0000000000..99d725fde5 --- /dev/null +++ b/apps/components-e2e/src/components/radio/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "radio", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["radio.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/radio:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/select/BUILD.bazel b/apps/components-e2e/src/components/select/BUILD.bazel new file mode 100644 index 0000000000..8e9f41059b --- /dev/null +++ b/apps/components-e2e/src/components/select/BUILD.bazel @@ -0,0 +1,23 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "select", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["select.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/select:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/show-more/BUILD.bazel b/apps/components-e2e/src/components/show-more/BUILD.bazel new file mode 100644 index 0000000000..5e53b861d5 --- /dev/null +++ b/apps/components-e2e/src/components/show-more/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "show-more", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["show-more.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/show-more:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/slider/BUILD.bazel b/apps/components-e2e/src/components/slider/BUILD.bazel new file mode 100644 index 0000000000..b3c9b99378 --- /dev/null +++ b/apps/components-e2e/src/components/slider/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "slider", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["slider.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/slider:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/stacked-series-chart/BUILD.bazel b/apps/components-e2e/src/components/stacked-series-chart/BUILD.bazel new file mode 100644 index 0000000000..6ea5c4cdbb --- /dev/null +++ b/apps/components-e2e/src/components/stacked-series-chart/BUILD.bazel @@ -0,0 +1,23 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "stacked-series-chart", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["stacked-series-chart.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/stacked-series-chart:compile", + "//libs/barista-components/theming:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/sunburst-chart/BUILD.bazel b/apps/components-e2e/src/components/sunburst-chart/BUILD.bazel new file mode 100644 index 0000000000..f925391875 --- /dev/null +++ b/apps/components-e2e/src/components/sunburst-chart/BUILD.bazel @@ -0,0 +1,24 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "sunburst-chart", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["sunburst-chart.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/sunburst-chart:compile", + "//libs/barista-components/theming:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/switch/BUILD.bazel b/apps/components-e2e/src/components/switch/BUILD.bazel new file mode 100644 index 0000000000..6894d8d005 --- /dev/null +++ b/apps/components-e2e/src/components/switch/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "switch", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["switch.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/switch:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/table/BUILD.bazel b/apps/components-e2e/src/components/table/BUILD.bazel new file mode 100644 index 0000000000..4858ca2d26 --- /dev/null +++ b/apps/components-e2e/src/components/table/BUILD.bazel @@ -0,0 +1,27 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "table", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = [ + "table/table.html", + "table-order-expandable/table-expandable.html", + ], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/table:compile", + "@npm//@angular/cdk", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/table-order/table-order-expandable/table-expandable.html b/apps/components-e2e/src/components/table/table-order-expandable/table-expandable.html similarity index 100% rename from apps/components-e2e/src/components/table-order/table-order-expandable/table-expandable.html rename to apps/components-e2e/src/components/table/table-order-expandable/table-expandable.html diff --git a/apps/components-e2e/src/components/table-order/table-order-expandable/table-expandable.ts b/apps/components-e2e/src/components/table/table-order-expandable/table-expandable.ts similarity index 100% rename from apps/components-e2e/src/components/table-order/table-order-expandable/table-expandable.ts rename to apps/components-e2e/src/components/table/table-order-expandable/table-expandable.ts diff --git a/apps/components-e2e/src/components/table-order/table.e2e.ts b/apps/components-e2e/src/components/table/table.e2e.ts similarity index 99% rename from apps/components-e2e/src/components/table-order/table.e2e.ts rename to apps/components-e2e/src/components/table/table.e2e.ts index 5967608ae8..adf592e358 100644 --- a/apps/components-e2e/src/components/table-order/table.e2e.ts +++ b/apps/components-e2e/src/components/table/table.e2e.ts @@ -25,8 +25,8 @@ import { changeOrderButton, } from './table.po'; -fixture('Table Order') - .page('http://localhost:4200/table-order') +fixture('Table') + .page('http://localhost:4200/table') .beforeEach(async () => { await resetWindowSizeToDefault(); await waitForAngular(); diff --git a/apps/components-e2e/src/components/table-order/table.module.ts b/apps/components-e2e/src/components/table/table.module.ts similarity index 96% rename from apps/components-e2e/src/components/table-order/table.module.ts rename to apps/components-e2e/src/components/table/table.module.ts index 3409ffbdbe..9c9f53888e 100644 --- a/apps/components-e2e/src/components/table-order/table.module.ts +++ b/apps/components-e2e/src/components/table/table.module.ts @@ -23,7 +23,7 @@ import { DT_UI_TEST_CONFIG, DT_DEFAULT_UI_TEST_CONFIG, } from '@dynatrace/barista-components/core'; -import { DtE2ETable } from './table-order/table'; +import { DtE2ETable } from './table/table'; import { DtE2ETableExpandable } from './table-order-expandable/table-expandable'; const routes: Route[] = [ diff --git a/apps/components-e2e/src/components/table-order/table.po.ts b/apps/components-e2e/src/components/table/table.po.ts similarity index 100% rename from apps/components-e2e/src/components/table-order/table.po.ts rename to apps/components-e2e/src/components/table/table.po.ts diff --git a/apps/components-e2e/src/components/table-order/table-order/table.html b/apps/components-e2e/src/components/table/table/table.html similarity index 100% rename from apps/components-e2e/src/components/table-order/table-order/table.html rename to apps/components-e2e/src/components/table/table/table.html diff --git a/apps/components-e2e/src/components/table-order/table-order/table.ts b/apps/components-e2e/src/components/table/table/table.ts similarity index 100% rename from apps/components-e2e/src/components/table-order/table-order/table.ts rename to apps/components-e2e/src/components/table/table/table.ts diff --git a/apps/components-e2e/src/components/tabs/BUILD.bazel b/apps/components-e2e/src/components/tabs/BUILD.bazel new file mode 100644 index 0000000000..b82c6e5a1e --- /dev/null +++ b/apps/components-e2e/src/components/tabs/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "tabs", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["tabs.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/tabs:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/tag/BUILD.bazel b/apps/components-e2e/src/components/tag/BUILD.bazel new file mode 100644 index 0000000000..4a438e2f8c --- /dev/null +++ b/apps/components-e2e/src/components/tag/BUILD.bazel @@ -0,0 +1,26 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "tag", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = [ + "tag-add/tag-add.html", + "tag-list/tag-list.html", + ], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/tag:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/tile/BUILD.bazel b/apps/components-e2e/src/components/tile/BUILD.bazel new file mode 100644 index 0000000000..8c64510403 --- /dev/null +++ b/apps/components-e2e/src/components/tile/BUILD.bazel @@ -0,0 +1,23 @@ + +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "tile", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["tile.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/tile:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/apps/components-e2e/src/components/tree-table/BUILD.bazel b/apps/components-e2e/src/components/tree-table/BUILD.bazel new file mode 100644 index 0000000000..baafa42ca5 --- /dev/null +++ b/apps/components-e2e/src/components/tree-table/BUILD.bazel @@ -0,0 +1,26 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "tree-table", + srcs = glob( + include = ["**/*.ts"], + exclude = [ + "**/*.po.ts", + "**/*.e2e.ts", + ], + ), + angular_assets = ["tree-table.html"], + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/tree-table:compile", + "@npm//@angular/cdk", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + "@npm//@dynatrace/barista-icons", + "@npm//rxjs", + ], +) diff --git a/apps/components-e2e/src/components/chart/chart/chart-series.ts b/apps/components-e2e/src/main.dev.ts similarity index 70% rename from apps/components-e2e/src/components/chart/chart/chart-series.ts rename to apps/components-e2e/src/main.dev.ts index a1a20087f5..11a05c9268 100644 --- a/apps/components-e2e/src/components/chart/chart/chart-series.ts +++ b/apps/components-e2e/src/main.dev.ts @@ -14,13 +14,8 @@ * limitations under the License. */ -import { generateData } from '@dynatrace/testing/fixtures'; +// Used to launch the application under Bazel development mode. +import { platformBrowser } from '@angular/platform-browser'; +import { DtE2EAppModule } from './app/app.module'; -export const series: Highcharts.IndividualSeriesOptions[] = [ - { - name: 'Requests', - type: 'column', - yAxis: 1, - data: generateData(40, 0, 200, 1370304000000, 900000), - }, -]; +platformBrowser().bootstrapModule(DtE2EAppModule); diff --git a/apps/components-e2e/src/main.prod.ts b/apps/components-e2e/src/main.prod.ts new file mode 100644 index 0000000000..d210ffdbb4 --- /dev/null +++ b/apps/components-e2e/src/main.prod.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2020 Dynatrace LLC + * 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. + */ + +// Used to launch the application under Bazel production mode. +import { enableProdMode } from '@angular/core'; +import { platformBrowser } from '@angular/platform-browser'; +import { DtE2EAppModule } from './app/app.module'; + +enableProdMode(); +platformBrowser().bootstrapModule(DtE2EAppModule); diff --git a/apps/components-e2e/src/main.scss b/apps/components-e2e/src/main.scss index ea5e4a5233..da9d08adb1 100644 --- a/apps/components-e2e/src/main.scss +++ b/apps/components-e2e/src/main.scss @@ -1,3 +1,5 @@ +@import '../../../libs/barista-components/style/index'; + // this reset is needed because protractor ignores a margin on // the body when asking for a location of an element body { diff --git a/apps/components-e2e/src/main.ts b/apps/components-e2e/src/main.ts index 4a8f9796ce..6f9d46ee2b 100644 --- a/apps/components-e2e/src/main.ts +++ b/apps/components-e2e/src/main.ts @@ -14,6 +14,13 @@ * limitations under the License. */ +// TODO: Remove once the app can be served with bazel +// This main entry point is used to launch the app under the +// @angular-devkit/build-angular, which is the default CLI +// builder. Note that for AOT, the CLI will magically replace +// the bootstrap by switching platform-browser-dynamic with +// platform-browser. +// This file is completely unused in the Bazel build. import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { DtE2EAppModule } from './app/app.module'; diff --git a/apps/components-e2e/src/services/BUILD.bazel b/apps/components-e2e/src/services/BUILD.bazel new file mode 100644 index 0000000000..a608424fd8 --- /dev/null +++ b/apps/components-e2e/src/services/BUILD.bazel @@ -0,0 +1,14 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//apps/components-e2e:__subpackages__"]) + +ng_module( + name = "services", + srcs = glob(["**/*.ts"]), + tsconfig = "//apps/components-e2e:tsconfig-app", + deps = [ + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//rxjs", + ], +) diff --git a/libs/barista-components/context-dialog/index.ts b/libs/barista-components/context-dialog/index.ts index 72e6ff3461..0ff3086ba8 100644 --- a/libs/barista-components/context-dialog/index.ts +++ b/libs/barista-components/context-dialog/index.ts @@ -14,8 +14,9 @@ * limitations under the License. */ -export * from './src/context-dialog-module'; export * from './src/context-dialog'; +export * from './src/context-dialog-module'; export * from './src/context-dialog-trigger'; +export * from './src/footer/context-dialog-footer'; export * from './src/header/context-dialog-header'; export * from './src/header/context-dialog-header-title'; diff --git a/libs/barista-components/experimental/combobox/BUILD.bazel b/libs/barista-components/experimental/combobox/BUILD.bazel index 06883a7d7e..e0bb3cb4c3 100644 --- a/libs/barista-components/experimental/combobox/BUILD.bazel +++ b/libs/barista-components/experimental/combobox/BUILD.bazel @@ -17,7 +17,7 @@ ng_module_view_engine( ":styles", "src/combobox.html", ], - module_name = "@dynatrace/barista-components/combobox", + module_name = "@dynatrace/barista-components/experimental/combobox", tsconfig = "tsconfig_lib", deps = [ "@npm//@angular/core", diff --git a/libs/barista-components/stacked-series-chart/index.ts b/libs/barista-components/stacked-series-chart/index.ts index f3194f7d73..b62d8e34f9 100644 --- a/libs/barista-components/stacked-series-chart/index.ts +++ b/libs/barista-components/stacked-series-chart/index.ts @@ -14,14 +14,15 @@ * limitations under the License. */ -export * from './src/stacked-series-chart.module'; +export * from './/src/stacked-series-chart-overlay.directive'; export * from './src/stacked-series-chart'; +export * from './src/stacked-series-chart.module'; export { + DtStackedSeriesChartFillMode, + DtStackedSeriesChartLegend, + DtStackedSeriesChartMode, DtStackedSeriesChartNode, DtStackedSeriesChartSeries, DtStackedSeriesChartTooltipData, DtStackedSeriesChartValueDisplayMode, - DtStackedSeriesChartMode, - DtStackedSeriesChartFillMode, - DtStackedSeriesChartLegend, } from './src/stacked-series-chart.util'; diff --git a/libs/barista-components/style/BUILD.bazel b/libs/barista-components/style/BUILD.bazel index 6e40f488ac..325b86cf2a 100644 --- a/libs/barista-components/style/BUILD.bazel +++ b/libs/barista-components/style/BUILD.bazel @@ -1,7 +1,7 @@ load("//tools/bazel_rules:index.bzl", "stylelint") -load("@io_bazel_rules_sass//:defs.bzl", "sass_library") +load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library") -package(default_visibility = ["//:__subpackages__"]) +package(default_visibility = ["//visibility:public"]) sass_library( name = "style", @@ -9,10 +9,42 @@ sass_library( ["**/*.scss"], ), deps = [ + ":angular_cdk", "//libs/barista-components/input:theme", ], ) +sass_library( + name = "angular_cdk", + srcs = [ + "@npm//:node_modules/@angular/cdk/_a11y.scss", + "@npm//:node_modules/@angular/cdk/_overlay.scss", + ], +) + +sass_library( + name = "barista_font", + srcs = [ + "@npm//:node_modules/@dynatrace/barista-fonts/typography.scss", + ], +) + +sass_binary( + name = "index", + src = "index.scss", + include_paths = ["external/npm"], + deps = [ + ":barista_font", + ":style", + ], +) + +sass_binary( + name = "main", + src = "main.scss", + deps = [":style"], +) + stylelint( name = "stylelint", srcs = glob(["**/*.scss"]), diff --git a/libs/barista-components/sunburst-chart/index.ts b/libs/barista-components/sunburst-chart/index.ts index e0eb585e72..df58ee2100 100644 --- a/libs/barista-components/sunburst-chart/index.ts +++ b/libs/barista-components/sunburst-chart/index.ts @@ -14,8 +14,9 @@ * limitations under the License. */ -export * from './src/sunburst-chart.module'; export * from './src/sunburst-chart'; +export * from './src/sunburst-chart.directive'; +export * from './src/sunburst-chart.module'; export { DtSunburstChartNode, DtSunburstChartTooltipData, diff --git a/libs/barista-components/tabs/index.ts b/libs/barista-components/tabs/index.ts index 8beff65e1c..53d2522929 100644 --- a/libs/barista-components/tabs/index.ts +++ b/libs/barista-components/tabs/index.ts @@ -14,9 +14,11 @@ * limitations under the License. */ -export * from './src/tabs-module'; +export * from './src/navigation/tab-group-navigation'; +export * from './src/navigation/tab-navigation-adapter'; export * from './src/tab-group'; export * from './src/tab/tab'; +export * from './src/tab/tab-body'; +export * from './src/tab/tab-content'; export * from './src/tab/tab-label'; -export * from './src/navigation/tab-group-navigation'; -export * from './src/navigation/tab-navigation-adapter'; +export * from './src/tabs-module'; diff --git a/libs/examples/BUILD.bazel b/libs/examples/BUILD.bazel index eeaebb6cdb..79f1d6821e 100644 --- a/libs/examples/BUILD.bazel +++ b/libs/examples/BUILD.bazel @@ -1,5 +1,6 @@ load("//libs/barista-components:config.bzl", "COMPONENT_TARGETS") load("//tools/bazel_rules:index.bzl", "stylelint") +load("@npm//@bazel/typescript:index.bzl", "ts_config") package(default_visibility = ["//:__subpackages__"]) @@ -20,5 +21,14 @@ filegroup( stylelint( name = "stylelint", srcs = glob(["**/*.scss"]), - config = ":.stylelintrc" + config = ":.stylelintrc", +) + +ts_config( + name = "tsconfig-lib", + src = ":tsconfig.lib.json", + deps = [ + ":tsconfig.json", + "//:tsconfig.base.json", + ], ) diff --git a/libs/examples/src/filter-field/BUILD.bazel b/libs/examples/src/filter-field/BUILD.bazel new file mode 100644 index 0000000000..9dc80a68f4 --- /dev/null +++ b/libs/examples/src/filter-field/BUILD.bazel @@ -0,0 +1,17 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//:__subpackages__"]) + +ng_module( + name = "filter-field", + srcs = glob(["**/*.ts"]), + angular_assets = glob(["**/*.html"]), + module_name = "@dynatrace/examples/filter-field", + tsconfig = "//libs/examples:tsconfig-lib", + deps = [ + "//libs/barista-components/filter-field:compile", + "//libs/barista-components/input:compile", + "@npm//@angular/core", + "@npm//@angular/forms", + ], +) diff --git a/libs/examples/src/quick-filter/BUILD.bazel b/libs/examples/src/quick-filter/BUILD.bazel new file mode 100644 index 0000000000..4492741088 --- /dev/null +++ b/libs/examples/src/quick-filter/BUILD.bazel @@ -0,0 +1,18 @@ +load("//tools/bazel_rules:index.bzl", "ng_module") + +package(default_visibility = ["//:__subpackages__"]) + +ng_module( + name = "quick-filter", + srcs = glob(["**/*.ts"]), + angular_assets = glob(["**/*.html"]), + module_name = "@dynatrace/examples/quick-filter", + tsconfig = "//libs/examples:tsconfig-lib", + deps = [ + "//libs/barista-components/core:compile", + "//libs/barista-components/experimental/quick-filter:compile", + "@npm//@angular/common", + "@npm//@angular/core", + "@npm//@angular/router", + ], +) diff --git a/libs/examples/tsconfig.lib.json b/libs/examples/tsconfig.lib.json index 2c16d82b53..ee47252594 100644 --- a/libs/examples/tsconfig.lib.json +++ b/libs/examples/tsconfig.lib.json @@ -16,5 +16,5 @@ "strictInjectionParameters": true, "enableResourceInlining": true }, - "include": ["**/*.ts"] + "include": ["**/*.d.ts"] } diff --git a/rules_sass-pr-122.patch b/rules_sass-pr-122.patch new file mode 100644 index 0000000000..f5fbeb8ce0 --- /dev/null +++ b/rules_sass-pr-122.patch @@ -0,0 +1,574 @@ +diff --git sass/BUILD sass/BUILD +index 5ebb982..4512c86 100644 +--- sass/BUILD ++++ sass/BUILD +@@ -1,7 +1,7 @@ +-package(default_visibility = ["//visibility:public"]) +- + load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") + ++package(default_visibility = ["//visibility:public"]) ++ + exports_files([ + "sass.bzl", + "sass_repositories.bzl", +@@ -10,10 +10,11 @@ exports_files([ + # Executable for the sass_binary rule + nodejs_binary( + name = "sass", +- entry_point = "sass_wrapper", + data = [ +- ":sass_wrapper.js", +- "@build_bazel_rules_sass_deps//sass", ++ ":dart-sass.js", + "@build_bazel_rules_sass_deps//@bazel/worker", ++ "@build_bazel_rules_sass_deps//sass", ++ "@build_bazel_rules_sass_deps//yargs", + ], ++ entry_point = "dart-sass.js", + ) +diff --git sass/package.json sass/package.json +index e098532..16fb82d 100644 +--- sass/package.json ++++ sass/package.json +@@ -1,6 +1,7 @@ + { + "devDependencies": { + "@bazel/worker": "latest", ++ "yargs": "~16.0.3", + "sass": "1.26.3" + } + } +diff --git sass/sass.bzl sass/sass.bzl +index 1601e34..e3b889b 100644 +--- sass/sass.bzl ++++ sass/sass.bzl +@@ -72,35 +72,24 @@ def _sass_library_impl(ctx): + def _run_sass(ctx, input, css_output, map_output = None): + """run_sass performs an action to compile a single Sass file into CSS.""" + +- # The Sass CLI expects inputs like +- # sass + args = ctx.actions.args() + +- # By default, the CLI of Sass writes the output file even if compilation failures have been +- # reported. We don't want this behavior in the Bazel action, as writing the actual output +- # file could let the compilation action appear successful. Instead, if we do not write any +- # file on error, Bazel will never report the action as successful if an error occurred. +- # https://sass-lang.com/documentation/cli/dart-sass#error-css +- args.add("--no-error-css") +- + # Flags (see https://github.com/sass/dart-sass/blob/master/lib/src/executable/options.dart) +- args.add_joined(["--style", ctx.attr.output_style], join_with = "=") ++ args.add("--style='%s'" % ctx.attr.output_style) + + if not ctx.attr.sourcemap: +- args.add("--no-source-map") ++ args.add("--noSourceMap") + elif ctx.attr.sourcemap_embed_sources: + args.add("--embed-sources") + + # Sources for compilation may exist in the source tree, in bazel-bin, or bazel-genfiles. + for prefix in [".", ctx.var["BINDIR"], ctx.var["GENDIR"]]: +- args.add("--load-path=%s/" % prefix) ++ args.add("--load-paths='%s/'" % prefix) + for include_path in ctx.attr.include_paths: +- args.add("--load-path=%s/%s" % (prefix, include_path)) ++ args.add("--load-paths='%s/%s'" % (prefix, include_path)) ++ ++ args.add("--files='%s:%s'" % (input.path, css_output.path)) + +- # Last arguments are input and output paths +- # Note that the sourcemap is implicitly written to a path the same as the +- # css with the added .map extension. +- args.add_all([input.path, css_output.path]) + args.use_param_file("@%s", use_always = True) + args.set_param_file_format("multiline") + +@@ -236,89 +225,91 @@ sass_binary = rule( + ) + + def _multi_sass_binary_impl(ctx): +- """multi_sass_binary accepts a list of sources and compile all in one pass. +- +- Args: +- ctx: The Bazel build context +- +- Returns: +- The multi_sass_binary rule. +- """ +- +- inputs = ctx.files.srcs +- outputs = [] +- # Every non-partial Sass file will produce one CSS output file and, +- # optionally, one sourcemap file. +- for f in inputs: +- # Sass partial files (prefixed with an underscore) do not produce any +- # outputs. +- if f.basename.startswith("_"): +- continue +- name = _strip_extension(f.basename) +- outputs.append(ctx.actions.declare_file( +- name + ".css", +- sibling = f, +- )) +- if ctx.attr.sourcemap: +- outputs.append(ctx.actions.declare_file( +- name + ".css.map", +- sibling = f, +- )) ++ """multi_sass_binary accepts a list of sources and compile all in one pass. + +- # Use the package directory as the compilation root given to the Sass compiler +- root_dir = ctx.label.package ++ Args: ++ ctx: The Bazel build context + +- # Declare arguments passed through to the Sass compiler. +- # Start with flags and then expected program arguments. +- args = ctx.actions.args() +- args.add("--style", ctx.attr.output_style) +- args.add("--load-path", root_dir) ++ Returns: ++ The multi_sass_binary rule. ++ """ + +- if not ctx.attr.sourcemap: +- args.add("--no-source-map") ++ inputs = ctx.files.srcs + +- args.add(root_dir + ":" + ctx.bin_dir.path + '/' + root_dir) +- args.use_param_file("@%s", use_always = True) +- args.set_param_file_format("multiline") ++ # Declare arguments passed through to the Sass JavaScript API wrapper. ++ args = ctx.actions.args() ++ outputs = [] ++ ++ # Every non-partial Sass file will produce one CSS output file and, ++ # optionally, one sourcemap file. ++ for f in inputs: ++ # Sass partial files (prefixed with an underscore) do not produce any ++ # outputs. ++ if f.basename.startswith("_"): ++ continue ++ name = _strip_extension(f.basename) ++ output = ctx.actions.declare_file( ++ name + ".css", ++ sibling = f, ++ ) ++ outputs.append(output) ++ args.add("--files='%s:%s'" % (f.path, output.path)) ++ if ctx.attr.sourcemap: ++ outputs.append(ctx.actions.declare_file( ++ name + ".css.map", ++ sibling = f, ++ )) ++ ++ # Use the package directory as the compilation root given to the Sass compiler ++ root_dir = (ctx.label.workspace_root + "/" if ctx.label.workspace_root else "") + ctx.label.package ++ ++ args.add("--style='%s'" % ctx.attr.output_style) ++ args.add("--load-paths='%s'" % root_dir) + +- if inputs: +- ctx.actions.run( +- inputs = inputs, +- outputs = outputs, +- executable = ctx.executable.compiler, +- arguments = [args], +- mnemonic = "SassCompiler", +- progress_message = "Compiling Sass", +- ) ++ if not ctx.attr.sourcemap: ++ args.add("--noSourceMap") ++ ++ args.use_param_file("@%s", use_always = True) ++ args.set_param_file_format("multiline") + +- return [DefaultInfo(files = depset(outputs))] ++ if inputs: ++ ctx.actions.run( ++ inputs = inputs, ++ outputs = outputs, ++ executable = ctx.executable.compiler, ++ arguments = [args], ++ mnemonic = "SassCompiler", ++ progress_message = "Compiling Sass", ++ ) ++ ++ return [DefaultInfo(files = depset(outputs))] + + multi_sass_binary = rule( +- implementation = _multi_sass_binary_impl, +- attrs = { +- "srcs": attr.label_list( +- doc = "A list of Sass files and associated assets to compile", +- allow_files = _ALLOWED_SRC_FILE_EXTENSIONS, +- allow_empty = True, +- mandatory = True, +- ), +- "sourcemap": attr.bool( +- doc = "Whether sourcemaps should be emitted", +- default = True, +- ), +- "output_style": attr.string( +- doc = "How to style the compiled CSS", +- default = "compressed", +- values = [ +- "expanded", +- "compressed", +- ], +- ), +- "compiler": attr.label( +- doc = _COMPILER_ATTR_DOC, +- default = Label("//sass"), +- executable = True, +- cfg = "host", +- ), +- } ++ implementation = _multi_sass_binary_impl, ++ attrs = { ++ "srcs": attr.label_list( ++ doc = "A list of Sass files and associated assets to compile", ++ allow_files = _ALLOWED_SRC_FILE_EXTENSIONS, ++ allow_empty = True, ++ mandatory = True, ++ ), ++ "sourcemap": attr.bool( ++ doc = "Whether sourcemaps should be emitted", ++ default = True, ++ ), ++ "output_style": attr.string( ++ doc = "How to style the compiled CSS", ++ default = "compressed", ++ values = [ ++ "expanded", ++ "compressed", ++ ], ++ ), ++ "compiler": attr.label( ++ doc = _COMPILER_ATTR_DOC, ++ default = Label("//sass"), ++ executable = True, ++ cfg = "host", ++ ), ++ }, + ) +diff --git sass/dart-sass.js sass/dart-sass.js +new file mode 100644 +index 0000000..9be02e2 +--- /dev/null ++++ sass/dart-sass.js +@@ -0,0 +1,157 @@ ++/** ++ * @license ++ * Copyright Google Inc. All Rights Reserved. ++ * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. ++ * ++ * A Sass compiler wrapper that supports bazel persistent worker protocol. ++ * ++ * Bazel can spawn a persistent worker process that handles multiple invocations. ++ * It can also be invoked with an argument file to run once and exit. ++ */ ++'use strict'; ++ ++const worker = require('@bazel/worker'); ++const sass = require('sass'); ++const yargs = require('yargs/yargs'); ++const fs = require('fs'); ++const path = require('path'); ++ ++if (require.main === module) { ++ // Bazel will pass a special argument to the program when it's running us as a worker ++ if (worker.runAsWorker(process.argv)) { ++ worker.debug('Running as a Bazel worker'); ++ ++ worker.runWorkerLoop(main); ++ } else { ++ // Running standalone so stdout is available as usual ++ console.debug('Running as a standalone process'); ++ ++ // The first argument to the program is prefixed with '@' ++ // because Bazel does that for param files. Strip it first. ++ const paramFile = process.argv[2].replace(/^@/, ''); ++ const args = fs.readFileSync(paramFile, 'utf-8').trim().split('\n'); ++ ++ // Bazel is just running the program as a single action, don't act like a worker ++ if (!main(args)) { ++ process.exitCode = 1; ++ } ++ } ++} ++ ++/** ++ * Main function that passes the arguments from the worker or standalone to the ++ * dart sass compiler ++ * @param {string[]} argv The parsed command line args ++ * @returns {boolean} Returns true if the compilation was successful. ++ */ ++function main(argv) { ++ // IMPORTANT don't log with console.out - stdout is reserved for the worker protocol. ++ // This is true for any code running in the program, even if it comes from a third-party library. ++ const { files, style, loadPaths, noSourceMap, embedSources } = yargs( ++ argv ++ ).options({ ++ files: { array: true, default: [] }, ++ style: { string: true, default: 'compressed' }, ++ noSourceMap: { boolean: true, default: false }, ++ 'embed-sources': { boolean: true }, ++ 'load-paths': { array: true, default: [] }, ++ }).argv; ++ ++ for (let i = 0, max = files.length; i < max; i++) { ++ const [input, outFile] = files[i].split(':'); ++ compileDartSass({ ++ style, ++ outFile, ++ input, ++ embedSources, ++ sourceMap: !noSourceMap, ++ loadPaths, ++ }); ++ } ++ ++ return true; ++} ++ ++/** ++ * Function that uses the dart sass nodeJS API to compile sass to css ++ * https://sass-lang.com/documentation/js-api ++ * @param {object} config Configuration that should be passed to the render function ++ * @param {string} config.input The sass file that should be compiled ++ * @param {string} config.outFile The css file that should be written ++ * @param {boolean} config.embedSources If the source Maps should be embedded ++ * @param {boolean} config.sourceMap If source maps should be written (default `true`) ++ * @param {string[]} config.loadPaths This array of strings option provides load paths for Sass to look for imports. ++ * @param {'compressed' | 'expanded'} config.style Output style of the resulting css ++ * @returns {void} ++ */ ++function compileDartSass(config) { ++ // IMPORTANT don't log with console.out - stdout is reserved for the worker protocol. ++ // This is true for any code running in the program, even if it comes from a third-party library. ++ ++ // use renderSync() as it is almost twice as fast as render() according to the ++ // official documentation. ++ const result = sass.renderSync({ ++ style: config.style, ++ // This option defines one or more additional handlers for loading files ++ // when a @use rule or an @import rule is encountered. This should handle the ++ // common WebPack import style from node_modules starting with ~ ++ importer: function (url) { ++ if (url.startsWith('~')) { ++ const resolvedFile = resolveScssFile( ++ path.resolve(url.replace('~', '../../external/npm/node_modules/')) ++ ); ++ ++ if (resolvedFile) { ++ return { ++ file: resolvedFile, ++ }; ++ } ++ } ++ // null, which indicates that it doesn't recognize the URL and another ++ // importer should be tried instead. ++ return null; ++ }, ++ sourceMap: config.sourceMap, ++ sourceMapContents: config.embedSources, ++ sourceMapEmbed: config.embedSources, ++ includePaths: [...config.loadPaths, '../../external/npm/node_modules/'], ++ file: config.input, ++ outFile: config.outFile, ++ }); ++ ++ fs.writeFileSync(config.outFile, result.css); ++ ++ if (config.sourceMap) { ++ fs.writeFileSync(`${config.outFile}.map`, result.map); ++ } ++} ++ ++/** ++ * Function to resolve a path for a supported import style file ending. ++ * https://sass-lang.com/documentation/at-rules/import#finding-the-file ++ * @param {string} importPath The import path where it should try to resolve the ++ * style file that can be imported or referenced via use ++ * @returns {string|undefined} Returns the resolved path if the file exists or undefined ++ * if it cannot resolve the path. ++ */ ++function resolveScssFile(importPath) { ++ const fileName = path.basename(importPath); ++ const variants = [ ++ `${importPath}.scss`, ++ `${importPath}.sass`, ++ `${importPath}.css`, ++ `${importPath}/${fileName}.scss`, ++ `${importPath}/${fileName}.sass`, ++ `${importPath}/_${fileName}.scss`, ++ `${importPath}/_${fileName}.sass`, ++ `${importPath}/_index.scss`, ++ `${importPath}/_index.sass`, ++ ]; ++ ++ for (let i = 0, max = variants.length; i < max; i++) { ++ // return the variant if the file exist ++ if (fs.existsSync(variants[i]) && fs.lstatSync(variants[i]).isFile()) { ++ return variants[i]; ++ } ++ } ++} +diff --git sass/yarn.lock sass/yarn.lock +index 2d21734..60f1653 100644 +--- sass/yarn.lock ++++ sass/yarn.lock +@@ -72,6 +72,18 @@ + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce" + integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ== + ++ansi-regex@^5.0.0: ++ version "5.0.0" ++ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" ++ integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== ++ ++ansi-styles@^4.0.0: ++ version "4.3.0" ++ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" ++ integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== ++ dependencies: ++ color-convert "^2.0.1" ++ + anymatch@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.0.tgz#e609350e50a9313b472789b2f14ef35808ee14d6" +@@ -107,6 +119,37 @@ braces@^3.0.2: + optionalDependencies: + fsevents "^2.0.6" + ++cliui@^7.0.0: ++ version "7.0.1" ++ resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.1.tgz#a4cb67aad45cd83d8d05128fc9f4d8fbb887e6b3" ++ integrity sha512-rcvHOWyGyid6I1WjT/3NatKj2kDt9OdSHSXpyLXaMWFbKpGACNW8pRhhdPUq9MWUOdwn8Rz9AVETjF4105rZZQ== ++ dependencies: ++ string-width "^4.2.0" ++ strip-ansi "^6.0.0" ++ wrap-ansi "^7.0.0" ++ ++color-convert@^2.0.1: ++ version "2.0.1" ++ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" ++ integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== ++ dependencies: ++ color-name "~1.1.4" ++ ++color-name@~1.1.4: ++ version "1.1.4" ++ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" ++ integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== ++ ++emoji-regex@^8.0.0: ++ version "8.0.0" ++ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" ++ integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== ++ ++escalade@^3.0.2: ++ version "3.1.0" ++ resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e" ++ integrity sha512-mAk+hPSO8fLDkhV7V0dXazH5pDc6MrjBTPyD3VeKzxnVFjH1MIxbCdqGZB9O8+EwWakZs3ZCbDS4IpRt79V1ig== ++ + fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" +@@ -119,6 +162,11 @@ fsevents@^2.0.6: + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" + integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== + ++get-caller-file@^2.0.5: ++ version "2.0.5" ++ resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" ++ integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== ++ + glob-parent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954" +@@ -138,6 +186,11 @@ is-extglob@^2.1.1: + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + ++is-fullwidth-code-point@^3.0.0: ++ version "3.0.0" ++ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" ++ integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== ++ + is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" +@@ -191,6 +244,11 @@ readdirp@^3.1.1: + dependencies: + picomatch "^2.0.4" + ++require-directory@^2.1.1: ++ version "2.1.1" ++ resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" ++ integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= ++ + sass@1.26.3: + version "1.26.3" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.26.3.tgz#412df54486143b76b5a65cdf7569e86f44659f46" +@@ -198,9 +256,57 @@ sass@1.26.3: + dependencies: + chokidar ">=2.0.0 <4.0.0" + ++string-width@^4.1.0, string-width@^4.2.0: ++ version "4.2.0" ++ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" ++ integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== ++ dependencies: ++ emoji-regex "^8.0.0" ++ is-fullwidth-code-point "^3.0.0" ++ strip-ansi "^6.0.0" ++ ++strip-ansi@^6.0.0: ++ version "6.0.0" ++ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" ++ integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== ++ dependencies: ++ ansi-regex "^5.0.0" ++ + to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" ++ ++wrap-ansi@^7.0.0: ++ version "7.0.0" ++ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" ++ integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== ++ dependencies: ++ ansi-styles "^4.0.0" ++ string-width "^4.1.0" ++ strip-ansi "^6.0.0" ++ ++y18n@^5.0.1: ++ version "5.0.2" ++ resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.2.tgz#48218df5da2731b4403115c39a1af709c873f829" ++ integrity sha512-CkwaeZw6dQgqgPGeTWKMXCRmMcBgETFlTml1+ZOO+q7kGst8NREJ+eWwFNPVUQ4QGdAaklbqCZHH6Zuep1RjiA== ++ ++yargs-parser@^20.0.0: ++ version "20.2.1" ++ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.1.tgz#28f3773c546cdd8a69ddae68116b48a5da328e77" ++ integrity sha512-yYsjuSkjbLMBp16eaOt7/siKTjNVjMm3SoJnIg3sEh/JsvqVVDyjRKmaJV4cl+lNIgq6QEco2i3gDebJl7/vLA== ++ ++yargs@~16.0.3: ++ version "16.0.3" ++ resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.0.3.tgz#7a919b9e43c90f80d4a142a89795e85399a7e54c" ++ integrity sha512-6+nLw8xa9uK1BOEOykaiYAJVh6/CjxWXK/q9b5FpRgNslt8s22F2xMBqVIKgCRjNgGvGPBy8Vog7WN7yh4amtA== ++ dependencies: ++ cliui "^7.0.0" ++ escalade "^3.0.2" ++ get-caller-file "^2.0.5" ++ require-directory "^2.1.1" ++ string-width "^4.2.0" ++ y18n "^5.0.1" ++ yargs-parser "^20.0.0" diff --git a/test-sass.patch b/test-sass.patch new file mode 100644 index 0000000000..eba04195a9 --- /dev/null +++ b/test-sass.patch @@ -0,0 +1,618 @@ +diff --git sass/BUILD sass/BUILD +index 5ebb982..fe3c556 100644 +--- sass/BUILD ++++ sass/BUILD +@@ -1,7 +1,7 @@ +-package(default_visibility = ["//visibility:public"]) +- + load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") + ++package(default_visibility = ["//visibility:public"]) ++ + exports_files([ + "sass.bzl", + "sass_repositories.bzl", +@@ -10,10 +10,11 @@ exports_files([ + # Executable for the sass_binary rule + nodejs_binary( + name = "sass", +- entry_point = "sass_wrapper", + data = [ +- ":sass_wrapper.js", +- "@build_bazel_rules_sass_deps//sass", ++ ":dart-sass.js", + "@build_bazel_rules_sass_deps//@bazel/worker", ++ "@build_bazel_rules_sass_deps//sass", ++ "@build_bazel_rules_sass_deps//yargs", + ], ++ entry_point = "dart-sass.js", + ) +diff --git sass/dart-sass.js sass/dart-sass.js +new file mode 100644 +index 0000000..9be02e2 +--- /dev/null ++++ sass/dart-sass.js +@@ -0,0 +1,157 @@ ++/** ++ * @license ++ * Copyright Google Inc. All Rights Reserved. ++ * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. ++ * ++ * A Sass compiler wrapper that supports bazel persistent worker protocol. ++ * ++ * Bazel can spawn a persistent worker process that handles multiple invocations. ++ * It can also be invoked with an argument file to run once and exit. ++ */ ++'use strict'; ++ ++const worker = require('@bazel/worker'); ++const sass = require('sass'); ++const yargs = require('yargs/yargs'); ++const fs = require('fs'); ++const path = require('path'); ++ ++if (require.main === module) { ++ // Bazel will pass a special argument to the program when it's running us as a worker ++ if (worker.runAsWorker(process.argv)) { ++ worker.debug('Running as a Bazel worker'); ++ ++ worker.runWorkerLoop(main); ++ } else { ++ // Running standalone so stdout is available as usual ++ console.debug('Running as a standalone process'); ++ ++ // The first argument to the program is prefixed with '@' ++ // because Bazel does that for param files. Strip it first. ++ const paramFile = process.argv[2].replace(/^@/, ''); ++ const args = fs.readFileSync(paramFile, 'utf-8').trim().split('\n'); ++ ++ // Bazel is just running the program as a single action, don't act like a worker ++ if (!main(args)) { ++ process.exitCode = 1; ++ } ++ } ++} ++ ++/** ++ * Main function that passes the arguments from the worker or standalone to the ++ * dart sass compiler ++ * @param {string[]} argv The parsed command line args ++ * @returns {boolean} Returns true if the compilation was successful. ++ */ ++function main(argv) { ++ // IMPORTANT don't log with console.out - stdout is reserved for the worker protocol. ++ // This is true for any code running in the program, even if it comes from a third-party library. ++ const { files, style, loadPaths, noSourceMap, embedSources } = yargs( ++ argv ++ ).options({ ++ files: { array: true, default: [] }, ++ style: { string: true, default: 'compressed' }, ++ noSourceMap: { boolean: true, default: false }, ++ 'embed-sources': { boolean: true }, ++ 'load-paths': { array: true, default: [] }, ++ }).argv; ++ ++ for (let i = 0, max = files.length; i < max; i++) { ++ const [input, outFile] = files[i].split(':'); ++ compileDartSass({ ++ style, ++ outFile, ++ input, ++ embedSources, ++ sourceMap: !noSourceMap, ++ loadPaths, ++ }); ++ } ++ ++ return true; ++} ++ ++/** ++ * Function that uses the dart sass nodeJS API to compile sass to css ++ * https://sass-lang.com/documentation/js-api ++ * @param {object} config Configuration that should be passed to the render function ++ * @param {string} config.input The sass file that should be compiled ++ * @param {string} config.outFile The css file that should be written ++ * @param {boolean} config.embedSources If the source Maps should be embedded ++ * @param {boolean} config.sourceMap If source maps should be written (default `true`) ++ * @param {string[]} config.loadPaths This array of strings option provides load paths for Sass to look for imports. ++ * @param {'compressed' | 'expanded'} config.style Output style of the resulting css ++ * @returns {void} ++ */ ++function compileDartSass(config) { ++ // IMPORTANT don't log with console.out - stdout is reserved for the worker protocol. ++ // This is true for any code running in the program, even if it comes from a third-party library. ++ ++ // use renderSync() as it is almost twice as fast as render() according to the ++ // official documentation. ++ const result = sass.renderSync({ ++ style: config.style, ++ // This option defines one or more additional handlers for loading files ++ // when a @use rule or an @import rule is encountered. This should handle the ++ // common WebPack import style from node_modules starting with ~ ++ importer: function (url) { ++ if (url.startsWith('~')) { ++ const resolvedFile = resolveScssFile( ++ path.resolve(url.replace('~', '../../external/npm/node_modules/')) ++ ); ++ ++ if (resolvedFile) { ++ return { ++ file: resolvedFile, ++ }; ++ } ++ } ++ // null, which indicates that it doesn't recognize the URL and another ++ // importer should be tried instead. ++ return null; ++ }, ++ sourceMap: config.sourceMap, ++ sourceMapContents: config.embedSources, ++ sourceMapEmbed: config.embedSources, ++ includePaths: [...config.loadPaths, '../../external/npm/node_modules/'], ++ file: config.input, ++ outFile: config.outFile, ++ }); ++ ++ fs.writeFileSync(config.outFile, result.css); ++ ++ if (config.sourceMap) { ++ fs.writeFileSync(`${config.outFile}.map`, result.map); ++ } ++} ++ ++/** ++ * Function to resolve a path for a supported import style file ending. ++ * https://sass-lang.com/documentation/at-rules/import#finding-the-file ++ * @param {string} importPath The import path where it should try to resolve the ++ * style file that can be imported or referenced via use ++ * @returns {string|undefined} Returns the resolved path if the file exists or undefined ++ * if it cannot resolve the path. ++ */ ++function resolveScssFile(importPath) { ++ const fileName = path.basename(importPath); ++ const variants = [ ++ `${importPath}.scss`, ++ `${importPath}.sass`, ++ `${importPath}.css`, ++ `${importPath}/${fileName}.scss`, ++ `${importPath}/${fileName}.sass`, ++ `${importPath}/_${fileName}.scss`, ++ `${importPath}/_${fileName}.sass`, ++ `${importPath}/_index.scss`, ++ `${importPath}/_index.sass`, ++ ]; ++ ++ for (let i = 0, max = variants.length; i < max; i++) { ++ // return the variant if the file exist ++ if (fs.existsSync(variants[i]) && fs.lstatSync(variants[i]).isFile()) { ++ return variants[i]; ++ } ++ } ++} +diff --git sass/package.json sass/package.json +index e098532..16fb82d 100644 +--- sass/package.json ++++ sass/package.json +@@ -1,6 +1,7 @@ + { + "devDependencies": { + "@bazel/worker": "latest", ++ "yargs": "~16.0.3", + "sass": "1.26.3" + } + } +diff --git sass/sass.bzl sass/sass.bzl +index 1601e34..e3b889b 100644 +--- sass/sass.bzl ++++ sass/sass.bzl +@@ -72,35 +72,24 @@ def _sass_library_impl(ctx): + def _run_sass(ctx, input, css_output, map_output = None): + """run_sass performs an action to compile a single Sass file into CSS.""" + +- # The Sass CLI expects inputs like +- # sass + args = ctx.actions.args() + +- # By default, the CLI of Sass writes the output file even if compilation failures have been +- # reported. We don't want this behavior in the Bazel action, as writing the actual output +- # file could let the compilation action appear successful. Instead, if we do not write any +- # file on error, Bazel will never report the action as successful if an error occurred. +- # https://sass-lang.com/documentation/cli/dart-sass#error-css +- args.add("--no-error-css") +- + # Flags (see https://github.com/sass/dart-sass/blob/master/lib/src/executable/options.dart) +- args.add_joined(["--style", ctx.attr.output_style], join_with = "=") ++ args.add("--style='%s'" % ctx.attr.output_style) + + if not ctx.attr.sourcemap: +- args.add("--no-source-map") ++ args.add("--noSourceMap") + elif ctx.attr.sourcemap_embed_sources: + args.add("--embed-sources") + + # Sources for compilation may exist in the source tree, in bazel-bin, or bazel-genfiles. + for prefix in [".", ctx.var["BINDIR"], ctx.var["GENDIR"]]: +- args.add("--load-path=%s/" % prefix) ++ args.add("--load-paths='%s/'" % prefix) + for include_path in ctx.attr.include_paths: +- args.add("--load-path=%s/%s" % (prefix, include_path)) ++ args.add("--load-paths='%s/%s'" % (prefix, include_path)) ++ ++ args.add("--files='%s:%s'" % (input.path, css_output.path)) + +- # Last arguments are input and output paths +- # Note that the sourcemap is implicitly written to a path the same as the +- # css with the added .map extension. +- args.add_all([input.path, css_output.path]) + args.use_param_file("@%s", use_always = True) + args.set_param_file_format("multiline") + +@@ -236,89 +225,91 @@ sass_binary = rule( + ) + + def _multi_sass_binary_impl(ctx): +- """multi_sass_binary accepts a list of sources and compile all in one pass. +- +- Args: +- ctx: The Bazel build context +- +- Returns: +- The multi_sass_binary rule. +- """ +- +- inputs = ctx.files.srcs +- outputs = [] +- # Every non-partial Sass file will produce one CSS output file and, +- # optionally, one sourcemap file. +- for f in inputs: +- # Sass partial files (prefixed with an underscore) do not produce any +- # outputs. +- if f.basename.startswith("_"): +- continue +- name = _strip_extension(f.basename) +- outputs.append(ctx.actions.declare_file( +- name + ".css", +- sibling = f, +- )) +- if ctx.attr.sourcemap: +- outputs.append(ctx.actions.declare_file( +- name + ".css.map", +- sibling = f, +- )) ++ """multi_sass_binary accepts a list of sources and compile all in one pass. + +- # Use the package directory as the compilation root given to the Sass compiler +- root_dir = ctx.label.package ++ Args: ++ ctx: The Bazel build context + +- # Declare arguments passed through to the Sass compiler. +- # Start with flags and then expected program arguments. +- args = ctx.actions.args() +- args.add("--style", ctx.attr.output_style) +- args.add("--load-path", root_dir) ++ Returns: ++ The multi_sass_binary rule. ++ """ + +- if not ctx.attr.sourcemap: +- args.add("--no-source-map") ++ inputs = ctx.files.srcs + +- args.add(root_dir + ":" + ctx.bin_dir.path + '/' + root_dir) +- args.use_param_file("@%s", use_always = True) +- args.set_param_file_format("multiline") ++ # Declare arguments passed through to the Sass JavaScript API wrapper. ++ args = ctx.actions.args() ++ outputs = [] ++ ++ # Every non-partial Sass file will produce one CSS output file and, ++ # optionally, one sourcemap file. ++ for f in inputs: ++ # Sass partial files (prefixed with an underscore) do not produce any ++ # outputs. ++ if f.basename.startswith("_"): ++ continue ++ name = _strip_extension(f.basename) ++ output = ctx.actions.declare_file( ++ name + ".css", ++ sibling = f, ++ ) ++ outputs.append(output) ++ args.add("--files='%s:%s'" % (f.path, output.path)) ++ if ctx.attr.sourcemap: ++ outputs.append(ctx.actions.declare_file( ++ name + ".css.map", ++ sibling = f, ++ )) ++ ++ # Use the package directory as the compilation root given to the Sass compiler ++ root_dir = (ctx.label.workspace_root + "/" if ctx.label.workspace_root else "") + ctx.label.package ++ ++ args.add("--style='%s'" % ctx.attr.output_style) ++ args.add("--load-paths='%s'" % root_dir) + +- if inputs: +- ctx.actions.run( +- inputs = inputs, +- outputs = outputs, +- executable = ctx.executable.compiler, +- arguments = [args], +- mnemonic = "SassCompiler", +- progress_message = "Compiling Sass", +- ) ++ if not ctx.attr.sourcemap: ++ args.add("--noSourceMap") ++ ++ args.use_param_file("@%s", use_always = True) ++ args.set_param_file_format("multiline") + +- return [DefaultInfo(files = depset(outputs))] ++ if inputs: ++ ctx.actions.run( ++ inputs = inputs, ++ outputs = outputs, ++ executable = ctx.executable.compiler, ++ arguments = [args], ++ mnemonic = "SassCompiler", ++ progress_message = "Compiling Sass", ++ ) ++ ++ return [DefaultInfo(files = depset(outputs))] + + multi_sass_binary = rule( +- implementation = _multi_sass_binary_impl, +- attrs = { +- "srcs": attr.label_list( +- doc = "A list of Sass files and associated assets to compile", +- allow_files = _ALLOWED_SRC_FILE_EXTENSIONS, +- allow_empty = True, +- mandatory = True, +- ), +- "sourcemap": attr.bool( +- doc = "Whether sourcemaps should be emitted", +- default = True, +- ), +- "output_style": attr.string( +- doc = "How to style the compiled CSS", +- default = "compressed", +- values = [ +- "expanded", +- "compressed", +- ], +- ), +- "compiler": attr.label( +- doc = _COMPILER_ATTR_DOC, +- default = Label("//sass"), +- executable = True, +- cfg = "host", +- ), +- } ++ implementation = _multi_sass_binary_impl, ++ attrs = { ++ "srcs": attr.label_list( ++ doc = "A list of Sass files and associated assets to compile", ++ allow_files = _ALLOWED_SRC_FILE_EXTENSIONS, ++ allow_empty = True, ++ mandatory = True, ++ ), ++ "sourcemap": attr.bool( ++ doc = "Whether sourcemaps should be emitted", ++ default = True, ++ ), ++ "output_style": attr.string( ++ doc = "How to style the compiled CSS", ++ default = "compressed", ++ values = [ ++ "expanded", ++ "compressed", ++ ], ++ ), ++ "compiler": attr.label( ++ doc = _COMPILER_ATTR_DOC, ++ default = Label("//sass"), ++ executable = True, ++ cfg = "host", ++ ), ++ }, + ) +diff --git sass/sass_wrapper.js sass/sass_wrapper.js +deleted file mode 100644 +index 88271a5..0000000 +--- sass/sass_wrapper.js ++++ /dev/null +@@ -1,38 +0,0 @@ +-/** +- * @license +- * Copyright Google Inc. All Rights Reserved. +- * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. +- * +- * A Sass compiler wrapper that supports bazel persistent worker protocol. +- * +- * Bazel can spawn a persistent worker process that handles multiple invocations. +- * It can also be invoked with an argument file to run once and exit. +- */ +-"use strict"; +- +-const {debug, runAsWorker, runWorkerLoop} = require('@bazel/worker'); +-const sass = require('sass'); +-const fs = require('fs'); +- +-const args = process.argv.slice(2); +-if (runAsWorker(args)) { +- debug('Starting Sass compiler persistent worker...'); +- runWorkerLoop(args => sass.cli_pkg_main_0_(args)); +- // Note: intentionally don't process.exit() here, because runWorkerLoop +- // is waiting for async callbacks from node. +-} else { +- debug('Running a single build...'); +- if (args.length === 0) throw new Error('Not enough arguments'); +- if (args.length !== 1) { +- throw new Error('Expected one argument: path to flagfile'); +- } +- +- // Bazel worker protocol expects the only arg to be @. +- // When we are running a single build, we remove the @ prefix and read the list +- // of actual arguments line by line. +- const configFile = args[0].replace(/^@+/, ''); +- const configContent = fs.readFileSync(configFile, 'utf8').trim(); +- sass.cli_pkg_main_0_(configContent.split('\n')); +-} +- +-process.exitCode = 0; +diff --git sass/yarn.lock sass/yarn.lock +index 2d21734..60f1653 100644 +--- sass/yarn.lock ++++ sass/yarn.lock +@@ -72,6 +72,18 @@ + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce" + integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ== + ++ansi-regex@^5.0.0: ++ version "5.0.0" ++ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" ++ integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== ++ ++ansi-styles@^4.0.0: ++ version "4.3.0" ++ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" ++ integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== ++ dependencies: ++ color-convert "^2.0.1" ++ + anymatch@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.0.tgz#e609350e50a9313b472789b2f14ef35808ee14d6" +@@ -107,6 +119,37 @@ braces@^3.0.2: + optionalDependencies: + fsevents "^2.0.6" + ++cliui@^7.0.0: ++ version "7.0.1" ++ resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.1.tgz#a4cb67aad45cd83d8d05128fc9f4d8fbb887e6b3" ++ integrity sha512-rcvHOWyGyid6I1WjT/3NatKj2kDt9OdSHSXpyLXaMWFbKpGACNW8pRhhdPUq9MWUOdwn8Rz9AVETjF4105rZZQ== ++ dependencies: ++ string-width "^4.2.0" ++ strip-ansi "^6.0.0" ++ wrap-ansi "^7.0.0" ++ ++color-convert@^2.0.1: ++ version "2.0.1" ++ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" ++ integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== ++ dependencies: ++ color-name "~1.1.4" ++ ++color-name@~1.1.4: ++ version "1.1.4" ++ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" ++ integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== ++ ++emoji-regex@^8.0.0: ++ version "8.0.0" ++ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" ++ integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== ++ ++escalade@^3.0.2: ++ version "3.1.0" ++ resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e" ++ integrity sha512-mAk+hPSO8fLDkhV7V0dXazH5pDc6MrjBTPyD3VeKzxnVFjH1MIxbCdqGZB9O8+EwWakZs3ZCbDS4IpRt79V1ig== ++ + fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" +@@ -119,6 +162,11 @@ fsevents@^2.0.6: + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" + integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== + ++get-caller-file@^2.0.5: ++ version "2.0.5" ++ resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" ++ integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== ++ + glob-parent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954" +@@ -138,6 +186,11 @@ is-extglob@^2.1.1: + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + ++is-fullwidth-code-point@^3.0.0: ++ version "3.0.0" ++ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" ++ integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== ++ + is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" +@@ -191,6 +244,11 @@ readdirp@^3.1.1: + dependencies: + picomatch "^2.0.4" + ++require-directory@^2.1.1: ++ version "2.1.1" ++ resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" ++ integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= ++ + sass@1.26.3: + version "1.26.3" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.26.3.tgz#412df54486143b76b5a65cdf7569e86f44659f46" +@@ -198,9 +256,57 @@ sass@1.26.3: + dependencies: + chokidar ">=2.0.0 <4.0.0" + ++string-width@^4.1.0, string-width@^4.2.0: ++ version "4.2.0" ++ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" ++ integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== ++ dependencies: ++ emoji-regex "^8.0.0" ++ is-fullwidth-code-point "^3.0.0" ++ strip-ansi "^6.0.0" ++ ++strip-ansi@^6.0.0: ++ version "6.0.0" ++ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" ++ integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== ++ dependencies: ++ ansi-regex "^5.0.0" ++ + to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" ++ ++wrap-ansi@^7.0.0: ++ version "7.0.0" ++ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" ++ integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== ++ dependencies: ++ ansi-styles "^4.0.0" ++ string-width "^4.1.0" ++ strip-ansi "^6.0.0" ++ ++y18n@^5.0.1: ++ version "5.0.2" ++ resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.2.tgz#48218df5da2731b4403115c39a1af709c873f829" ++ integrity sha512-CkwaeZw6dQgqgPGeTWKMXCRmMcBgETFlTml1+ZOO+q7kGst8NREJ+eWwFNPVUQ4QGdAaklbqCZHH6Zuep1RjiA== ++ ++yargs-parser@^20.0.0: ++ version "20.2.1" ++ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.1.tgz#28f3773c546cdd8a69ddae68116b48a5da328e77" ++ integrity sha512-yYsjuSkjbLMBp16eaOt7/siKTjNVjMm3SoJnIg3sEh/JsvqVVDyjRKmaJV4cl+lNIgq6QEco2i3gDebJl7/vLA== ++ ++yargs@~16.0.3: ++ version "16.0.3" ++ resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.0.3.tgz#7a919b9e43c90f80d4a142a89795e85399a7e54c" ++ integrity sha512-6+nLw8xa9uK1BOEOykaiYAJVh6/CjxWXK/q9b5FpRgNslt8s22F2xMBqVIKgCRjNgGvGPBy8Vog7WN7yh4amtA== ++ dependencies: ++ cliui "^7.0.0" ++ escalade "^3.0.2" ++ get-caller-file "^2.0.5" ++ require-directory "^2.1.1" ++ string-width "^4.2.0" ++ y18n "^5.0.1" ++ yargs-parser "^20.0.0"