chromium/ui/file_manager/file_manager/foreground/js/BUILD.gn

# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/closure_compiler/compile_js.gni")
import("//third_party/closure_compiler/js_unit_tests.gni")
import("//ui/file_manager/base/gn/js_test_type_check.gni")
import("//ui/webui/resources/tools/optimize_webui.gni")

visibility = [
  "//ui/file_manager/file_manager/externs/*",
  "//ui/file_manager/file_manager/foreground/*",
  "//ui/file_manager/file_manager/test/*",
]

# Root directory for the foreground bundle.
tsc_folder =
    rebase_path("$target_gen_dir/../../../tsc/file_manager/foreground/js",
                root_build_dir)

# Path where chrome://file-manager should be mapped.
files_app_path =
    rebase_path("$target_gen_dir/../../../tsc/file_manager/", root_build_dir)
image_loader_path =
    rebase_path("$root_gen_dir/ui/file_manager/tsc/image_loader",
                root_build_dir)

optimize_webui("build") {
  visibility += [ "//ui/file_manager:build_grd" ]
  host = "file-manager"

  input = tsc_folder
  js_module_in_files = [
    "main.js",
    "deferred_elements.js",
  ]

  external_paths = [
    # Mapping for the absolute chrome://file-manager/common/js/lru_cache.js
    # import in image_loader.
    "chrome://file-manager|$files_app_path",
    "chrome-extension://pmfjbimdmchhbnneeidfognadeopoehp|$image_loader_path",
  ]

  deps = [
    "//ash/webui/common/resources/cr_elements:build_ts",
    "//ui/file_manager:build_ts",
    "//ui/webui/resources/cr_components/color_change_listener:build_ts",
    "//ui/webui/resources/js:build_ts",
  ]
}

optimize_webui("build_worker") {
  visibility += [ "//ui/file_manager:build_grd" ]
  host = "file_manager"

  input = tsc_folder
  js_module_in_files = [ "metadata/metadata_dispatcher.js" ]

  external_paths = [
    "chrome-extension://pmfjbimdmchhbnneeidfognadeopoehp|$image_loader_path",
  ]

  deps = [ "//ui/file_manager:build_ts" ]
}